Ovid poec at yahoo.com
Thu Jul 11 16:59:29 CDT 2002

--- Austin Schutz <tex at off.org> wrote:
> 	I suspect you can't use $1 et al because they are only scoped
> inside of case().

While I haven't used Switch.pm, I think you're correct.  The ${digit} variables are automatically
scoped to the current block and this can cause some surprising behavior.  From "perldoc perlvar":

        Contains the subpattern from the corresponding set
        of capturing parentheses from the last pattern
        match, not counting patterns matched in nested
        blocks that have been exited already.  (Mnemonic:
        like \digits.)  These variables are all read-only
        and dynamically scoped to the current BLOCK.

Curtis "Ovid" Poe

"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push at A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift at a;shift at a if $a[$[]eq$[;$_=join q||, at a};print $_,$/for reverse @A

Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free

More information about the Pdx-pm-list mailing list