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

Re: Regex question

by thelenm (Vicar)
on Mar 19, 2004 at 22:07 UTC ( #338191=note: print w/replies, xml ) Need Help??


in reply to Regex question

What I would do is set the default value first, then try the match. Something like this:

$match = "chiapet"; # default value if ($string =~ /foobar(...)/) { # probably want to capture something +here $match = $1; }

Or the ternary ?: operator, like this:

$match = ($string =~ /foobar(...)/) ? $1 : "chiapet";

-- Mike

--
XML::Simpler does not require XML::Parser or a SAX parser. It does require File::Slurp.
-- grantm, perldoc XML::Simpler

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://338191]
help
Chatterbox?
[choroba]: Tux Why? It works for me with 16 :-)
[Tux]: and the defailt is 15?
[choroba]: sorry, typo. Works for me with 15 which is the default
[choroba]: Timestamps should work correctly now

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2017-09-19 20:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (228 votes). Check out past polls.

    Notices?