[vox-tech] perl: quoting strings with spaces

Peter Jay Salzman vox-tech@lists.lugod.org
Sat, 21 Jun 2003 17:22:17 -0700


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