Koichi Nakatani wrote:
> Torrey McMahon -- SysAdmin McLean VA wrote:
> ! ($boundary) = $content =~ m%boundary\s*=\s*(\S+)%i;
I don't understand the what the (original) code what's to do here. Compare
% perl -e '$x=blaxxbal; ($y) = $x =~ m/x/; print "$y|$x\n"'
1|blaxxbal
shouldn't this be ($boundary = $content) =~ m%boundary\s*=\s*(\S+)%i;
% perl -e '$x=blaxxbal; ($y = $x) =~ m/x/; print "$y|$x\n"'
blaxxbal|blaxxbal
The key thing to note is the parenthesis in the match. You
can use a short-cut in assigning grouped patterns as follows:
($match1, $match2, ..., $matchN) = $str =~ /(...)(...)...(...)/;
which is short for:
$str =~ /(...)(...)...(...)/;
($match1, $match2, ..., $matchN) = ($1, $2, ..., $N);
Hence, the original statement is what is intended.
--ewh