What fun!
#!/usr/bin/perl use warnings; use strict; $\ = "\n"; $_ = "123123123"; my %x = ( 9 => "abc", foo => "abc" ); eval '/^$x{9}$/'; print '1. "$x" requires explicit package name' if $@; my $x = "[123]"; print "2. matches" if /^$x{9}$/; print "3. matches" if /^$x{5,12}$/; my $nine = 9; print "4. no match" unless /^$x{foo}$/; print "5. no match" unless /^$x{"9"}$/; print "6. no match" unless /^$x{0+9}$/; print "7. no match" unless /^$x{$nine}$/; print "8. matches" if /^${x}{$nine}$/; print "9. matches" if /^${x}{9}$/; print "10. no match" unless /^${x}{0+9}$/;
Good Day,
Dean
In reply to Of scalars, hashes, quantifiers, and regexen by duelafn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |