Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: March a regex using split function

by Laurent_R (Canon)
on Sep 13, 2017 at 06:14 UTC ( [id://1199262]=note: print w/replies, xml ) Need Help??


in reply to Re^2: March a regex using split function
in thread March a regex using split function

You could probably use something like this:
my ($f) = $s =~ m{FREE: (\d+)} or die 'no FREE';
But AnomalousMonk's proposal is arguably more readable.

Also, the \s* makes is possible to cope with possible variations in the number of spaces between FREE: and the value. Perhaps you don't need it if you can be absolutely sure that there will always be one and only one space there, but can you be that sure?

Replies are listed 'Best First'.
Re^4: March a regex using split function
by perldigious (Priest) on Sep 13, 2017 at 12:56 UTC

    You missed a great opportunity to make a Larry Wall style in code pun here...

    or die 'if not FREE'; #William Wallace agrees! :-)

    Just another Perl hooker - My clients appreciate that I keep my code clean but my comments dirty.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-24 11:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found