in reply to Print unless behaving strangely

This $_ = PID: , VID: 255, SN: AGM163923J5 isn't Perl code°... did you forget quotes around the string?

Do you use strict and warnings ?

Cheers Rolf

( addicted to the Perl Programming Language)

°) or at least not the one you expect. :-)

Replies are listed 'Best First'.
Re^2: Print unless behaving strangely
by boftx (Deacon) on Jun 01, 2014 at 21:48 UTC

    I gave him the benefit of the doubt and assumed he was saying "$_ contains the value 'PID: , VID: 255, SN: AGM163923J5'. Here is what happens ...".

    Even so, this snippet works for me:

    my $foo = 'PID: , VID: 255, SN: AGM163923J5'; print "NOT MATCHED!\n" unless $foo =~ /PID: ,/;

    It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.