Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: To Pattern Match or not to Pattern Match

by Roy Johnson (Monsignor)
on Mar 04, 2005 at 00:05 UTC ( #436417=note: print w/replies, xml ) Need Help??


in reply to To Pattern Match or not to Pattern Match

Try #2: I just realized what you're expecting it to do. You have nested loops, and your test is inside the innermost loop. So it's going to run 20 times (inner loop) for each of the 10 names (outer loop).

The "operator to state if nothing matches" might be grep. Something like:

for my $user_id (@cdwv_list) { my ($names) = grep(/^\Q$user_id/, @names); if ($names) { ($name) = $names =~ /\/([\w\s]+)\|/; } else { print "$userid does not exist in name list\n"; } }

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: To Pattern Match or not to Pattern Match
by Anonymous Monk on Mar 04, 2005 at 00:35 UTC
    Roy Johnson, thanks for your help. The code works exactly like what I needed. Thanks to everyone else that responded. If I had any sort of pts or anything to give you guys I would. I greatly appreciate the help. --Thomas

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2022-01-27 23:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (72 votes). Check out past polls.

    Notices?