Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Print unless behaving strangely

by Laurent_R (Parson)
on Jun 01, 2014 at 22:08 UTC ( #1088211=note: print w/ replies, xml ) Need Help??


in reply to Print unless behaving strangely

To me, the regex is correct. I tried to copy and paste the exact code that you posted under the Perl debugger:

DB<1> $_ = "PID: , VID: 255, SN: AGM163923J5"; DB<2> print $_ unless /PID: ,/; DB<3>
So it works as I expected (not printing $_ because of the successful match) and not as your reported result. Could it be that there are really two spaces between the colon after PID and the comma, or perhaps a tab and not a space, or some other special character? A starting point for the investigation might be to try this:
print $_ unless /PID:\s+,/;
to see if it matches or not.


Comment on Re: Print unless behaving strangely
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1088211]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (12)
As of 2014-12-21 14:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (106 votes), past polls