[vox-tech] perl: quoting strings with spaces

Jay Strauss vox-tech@lists.lugod.org
Sun, 22 Jun 2003 00:01:11 -0500


Or you can do it like: ('Amador','Calaveras','El Dorado','Humboldt','Lake
Tehama','Trinity')

----- Original Message ----- 
From: "Peter Jay Salzman" <p@dirac.org>
To: <vox-tech@lists.lugod.org>
Sent: Saturday, June 21, 2003 7:22 PM
Subject: [vox-tech] perl: quoting strings with spaces


> sorry for the line length.
>
> when using a quoting operator like qw and friends, how does one one
> quote a string with spaces?   in the code snippet below, my code chokes
> on "El Dorado".
>
> i also tried
>
> foreach my $county (qw/Amador Calaveras q+El Dorado+ Humboldt Lake Tehama
Trinity/)
>
> and expected it to work, but it didn't.
>
> thanks,
> pete
>
>
>
>
> sub PrintByCounty()
> {
>   foreach my $county (qw/Amador Calaveras 'El Dorado' Humboldt Lake Tehama
Trinity/)
>   {
>     foreach (@sites)
>     {
>       if ($county{$_} eq $county) {
>         print "<TR><TD><A href=\"$_\">SHL
$number{$_}</A></TD><TD>$name{$_}</TD>\n";
>       }
>     }
>   }
> }
>
> -- 
> GPG Instructions: http://www.dirac.org/linux/gpg
> GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D
> _______________________________________________
> vox-tech mailing list
> vox-tech@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech
>
>