Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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

by Marshall (Abbot)
on Mar 02, 2012 at 13:02 UTC ( #957458=note: print w/replies, xml ) Need Help??

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

#!/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://957458]
[1nickt]: yes.
[1nickt]: one of the largest distros
[Corion]: I wait for the day when DateTime uses Moose ;)
[TCLion]: finaly finished the install wow that was over 10 min
[1nickt]: Corion using Moose will hardly reduce the number of dependencies or time to install DT !
[davido]: That's like wishing that your motorcycle came with a sherman tank as a trailer.
[Corion]: davido: No, more like my one sherman tank had a second sherman tank tied to its back ;)

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2017-03-23 15:27 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (289 votes). Check out past polls.