Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: What is this erroring out?

by Hue-Bond (Priest)
on Mar 16, 2010 at 08:03 UTC ( #828839=note: print w/replies, xml ) Need Help??

in reply to What is this erroring out?

When the line return 0 if ($2 !~ /(d|p|t)/); is executed, $2 is undef because in the previous regex matching (the one in the line just above it!) has only one pair of parentheses. Use something like this (untested):

sub test { my $a = shift; my ($first, $second, $third, $fourth, $fifth) = $a =~ /(.)(.)(.)(.. +)(.+)/; return 0 if ($first !~ /(a)/); return 0 if ($second !~ /(d|p|t)/); return 0 if ($third !~ /(a|h|r|s|t)/); return 0 if ($fourth !~ /(aw|er|dd|cb|aa)/); }

 David Serrano
 (Please treat my english text just like Perl code, i.e. feel free to notify me of any syntax, grammar, style and/or spelling error. Thank you!).

Replies are listed 'Best First'.
Re^2: What is this erroring out?
by yoda54 (Monk) on Mar 16, 2010 at 08:08 UTC
    Thanks you!!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://828839]
[marioroy]: It's a quoting issue inside qx. It's File::Find or qx. LA chooses qx. Almost there.
[marioroy]: Also \"%S\\\n\" oh my, not fun.
[Discipulus]: good night folks
[marioroy]: I will make a mp3info script that takes the -p "%S\n" args and test qx. I'm on the road, so will come back.
[marioroy]: All because File::Find is not fun for LA.
[marioroy]: good night Discipulus.
[Discipulus]: perl dreams to you all
[marioroy]: LA my @music_times = qx(find \$HOME/Music/ Albums -type f -iname \'*.mp3\' -exec mp3info -p \"%S\\n\" {} \\;);

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2017-04-23 21:22 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (432 votes). Check out past polls.