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

Re^2: Getting rid of a temporary variable in AoH

by Arunbear (Parson)
on Jun 11, 2013 at 15:53 UTC ( #1038283=note: print w/replies, xml ) Need Help??


in reply to Re: Getting rid of a temporary variable in AoH
in thread Getting rid of a temporary variable in AoH

Or using named captures:
use strict; use warnings; use Data::Dumper; my @users; while (<DATA>) { m#^\s*(?<login>[\w-]+) :x :(?<uid>\d+) :(?<gid>\d+) :(?<name>[\w\s(),-]*) :(?<home>[\w/]+) :(?<shell>[\w/]*)$#x or die "Malformed input [$_]"; push @users, { %+ }; } print Dumper \@users; __DATA__ root:x:0:0::/:/usr/bin/ksh paul:x:201:1::/home/paul:/usr/bin/ksh jdoe:x:202:1:John Doe:/home/jdoe:/usr/bin/ksh

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1038283]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (1)
As of 2016-12-04 03:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (61 votes). Check out past polls.