At Thu, 09 Dec 2004 21:05:24 -0600, Will Schroeder wrote:
> 1: in a pattern match like [$ if ( $fdat{QC} =~ m/(\d+)/ ) $]
> [- $num = $1 -]
> for example. The $1 variable never seems to get populated during the
> match like in a regular old perl script.
aiui, the value of $1, etc variables are "lexically scoped" in perl.
so this should work fine:
[-
if ( $fdat{QC} =~ m/(\d+)/ ) {
$num = $1;
}
-]
whereas your code gets turned into something more like this by
embperl:
if ( eval { $fdat{QC} =~ m/(\d+)/ } ) {
eval { $num = $1 };
}
so $1 loses its value across embperl blocks, in the same way that "my"
variables, etc are also limited to a single embperl block
(ignoring [* *] blocks for the moment).
--
- Gus
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]