However, might I suggest you look at the Readonly module on cpan for an alternative method of creating constants.my ($y, $m, $d) = ($s =~ /@{[REGEX]}/)[0, 1, 2];
use Data::Dumper; use Readonly; use strict; Readonly my $REGEX => qr/^(\d{4})-(\d{2})-(\d{2})/; my $s = '2011-02-15'; my ($y, $m, $d) = ($s =~ $REGEX); print Data::Dumper->Dump([$y, $m, $d], [qw/y m d/]);
In reply to Re: qr expression defined as constant?
by wind
in thread qr expression defined as constant?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |