Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Fine tuning my condition statement

by strider corinth (Friar)
on Nov 20, 2002 at 18:28 UTC ( [id://214562]=note: print w/replies, xml ) Need Help??


in reply to Fine tuning my condition statement

One way would be this:
next if $field =~ /^(first|second|third)$/;
The '^' matches the beginning of a string, and the '$' matches the end, emulating an 'eq' function for whatever's in between them. The '|'s are roughly equivalent to an 'or' statement: this will match 'first' or 'second' or 'third'.

Update: added explanation, and parens, thanks to Enlil.
--
Love justice; desire mercy.

Replies are listed 'Best First'.
Re: Re: Fine tuning my condition statement
by Anonymous Monk on Nov 20, 2002 at 20:25 UTC
    Thanks for everyones help and answers.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-03-28 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found