Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^2: If statement seems to ignore elsif and skips to else

by AnomalousMonk (Chancellor)
on Sep 25, 2017 at 23:19 UTC ( #1200076=note: print w/replies, xml ) Need Help??

in reply to Re: If statement seems to ignore elsif and skips to else
in thread If statement seems to ignore elsif and skips to else

I suspect your first or (at Ln 7) is NOT doing what you expect. You have two alternatives at Ln 8 & 9 (where you start another or clause. Suggest you group your alternatives.

I don't understand this point. Unless the OP was updated after your post and the update is not cited (in which case edgreenberg is in line to be officially Frowned Upon), all the
    ($ThisLine =~ /..,... DEBUG: /)
and etc. matching expressions seem to be fully parenthesized and the logic unambiguous. Can you expand on this point?

my $re_start = qr/../; #match string begining with two of anything (0 +or more times each!) # but still a potential problem: would match a +null string) # so, perhaps, qr/.{1).(1)/ which will not allow + a string # (preceding the comma in your initial set of rege +xen) # with anything other than two instances of somethin +g # or another

I also don't get the point about  .. matching "two of anything (0 or more times ...)" and therefore possibly matching the "null" (by which I assume you mean empty) string. The only way I can see for the regex object you give in your example to match the empty string is if it is further quantified with some quantifier such as  ? * {0} {0,} that allows zero matches. However,
    qr{ .{1}.{1} }xms
has the same problem:

c:\@Work\Perl\monks>perl -wMstrict -le "my $rx_dotdot = qr{ .. }xms; print 'A: match empty string' if '' =~ $rx_dotdot; ;; my $rx_counted = qr{ .{1}.{1} }xms; print 'B: match empty string: counted' if '' =~ $rx_counted; ;; print 'C: match empty string: counted, quantified' if '' =~ m{ $rx_counted? }xms; " C: match empty string: counted, quantified
The only advantage I can see for the  .{1}.{1} variation is that it makes dot-dot more visually prominent.

Perhaps some testing is, indeed, called for.

Give a man a fish:  <%-{-{-{-<

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1200076]
[chickenman]: Thank you, I am looking for enlightenment! ;)
[chickenman]: Unfortunatly no standard, Its the Output of some command
[Discipulus]: ouch! it outputs always same fields?
[harishnv]: Can someone give me a solution fast

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2018-02-20 08:19 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (268 votes). Check out past polls.