Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^2: Why this simple code doesn't work?

by uksza (Abbot)
on Mar 02, 2012 at 10:33 UTC ( #957433=note: print w/replies, xml ) Need Help??

in reply to Re: Why this simple code doesn't work?
in thread Why this simple code doesn't work?

If "?" is the delimiter, then a match-only-once rule applies
thank you!

Replies are listed 'Best First'.
Re^3: Why this simple code doesn't work?
by Marshall (Abbot) on Mar 02, 2012 at 13:02 UTC
    #!/usr/bin/perl -w use strict; use 5.10.0; while (<DATA>) { chomp; process_path($_); } sub process_path { my $path = shift; if ( $path =~ m{^.*/home/(.*)/\.forward} ) # m[...] or # m|...| works also { say "i've got >$1<"; } else { say "ups >$path<"; } } =prints i've got >aaa< i've got >bbb< i've got >ccc< i've got >ddd< =cut __DATA__ /home/aaa/.forward /home/bbb/.forward /home/ccc/.forward /home/ddd/.forward

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://957433]
[marto]: good morning all, snow day here, won't make it to the office
[Corion]: marto: Oof - that means taking a day off or can you work from home?
[marto]: Corion, I can do some non-technical things, but there's no way for me to connect to the clients network.
[marto]: which is a shame, I had a really productive day yesterday
[Corion]: marto: Meh, so it'll be a day of cleaning out email...
[marto]: and hoped that I'd be able to continue the momentum :)
[marto]: I can't even access client email, nor my employers since those idiots moved to citrix

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2018-01-16 08:47 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (175 votes). Check out past polls.