P
Petr Sezemsky
Hi,
Why using the regex in switch - case doesn't fill the $1, $2, ..
variables? This code works as I expect:
#!/usr/bin/perl
$_ = "hello world";
if (/he(ll)o/) {
print "OK: $1\n";
}
but the next doesn't work as the previous:
#!/usr/bin/perl
use Switch;
$_ = "hello world";
switch ($_) {
case (/he(ll)o/) {
print "OK: $1\n";
}
}
Thank you for explanation the problem.
Petr
Why using the regex in switch - case doesn't fill the $1, $2, ..
variables? This code works as I expect:
#!/usr/bin/perl
$_ = "hello world";
if (/he(ll)o/) {
print "OK: $1\n";
}
but the next doesn't work as the previous:
#!/usr/bin/perl
use Switch;
$_ = "hello world";
switch ($_) {
case (/he(ll)o/) {
print "OK: $1\n";
}
}
Thank you for explanation the problem.
Petr