in reply to How to insert || and && in an if loop
No need for the 'g' modifier.
Why not die with a message, rather than print and exit?
Other than that, assuming your else condition is pseudo-code, it looks like it ought to work.
But I'd probably do something like this:
die "Either : already in string on the length is invalid\n" if $string =~ /:/ || length($string)!=16; print "work on that string"
Update: Another non-working option:
die "..." if $string =~ /:|.{17}/;
See below. Thanks AnomalousMonk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to insert || and && in an if loop
by AnomalousMonk (Archbishop) on Dec 17, 2011 at 21:59 UTC |