Subject: | comments and regular expression cases |
Date: | Wed, 26 Sep 2007 14:14:32 +0200 |
To: | bug-Switch [...] rt.cpan.org |
From: | paddor <paddor [...] gmail.com> |
Hello
It's very strange.
The code below does neither work with Switch 2.13 on RedHat x86_64 nor
with Switch 2.10_01 on Gentoo x86_64.
If I don't use a regular expression in the case statement, it works.
If I remove the COMMENTED sub "h2a" at the end, it works.
If I do both, it works.
Show quoted text
--- code BEGIN ---
#! /usr/bin/env perl
use Switch; # for switch-case conditions
my $usage = "This is the Usage.";
switch ($ARGV[0]) {
case "-f" {
print "A file is read.";
}
case /^-/ {
print $usage;
} else {
print "This is the else-block.";
}
}
#sub h2a {
# join '', map chr hex, split /:/, $_[0];
#}
--- code END ---
Greets, paddor