So, I have this script, but it doesn't work (syntax error), it's obviously because Perl sux... But, maybe you can fix it? Or maybe it even works for you?
#!/usr/bin/perl
use Switch;
print (10 / 2) ."\n";
while (<>)
{
switch ($_)
{
case (/^EXIT\n$/i)
{
exit 0;
}
else
{
print $_;
}
}
}
this is all great if you want to make some nice write-only perl
Name:
Anonymous2007-07-31 18:34 ID:Xd9/4BZ9
the Switch module sucks, use something else
Name:
Anonymous2007-07-31 18:43 ID:Xd9/4BZ9
print 10 / 2, "\n";
while (my $line = <>) {
exit if $line =~ /^exit\n/i;
print $line;
}
Name:
Anonymous2007-07-31 19:38 ID:oPzZQth4
That code was just an example to illustrate the bug. Apparently you can't have division before switch, it's known and accepted (because it's "too hard to fix") bug.
use Switch;
print 1/1 ."\n";
switch("y"){case/y/{print"y\n"}else{print"n\n"}}
Remove the second or third line and the code works, but not with both of these completely unrelated lines intact.
Name:
Anonymous2007-07-31 19:43 ID:oPzZQth4
OK, lets reuse this thread and talk about alternatives to Switch. Which one is your favorite? To me they all look like shit.