Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Column Heading and Split Function

by thirdm (Sexton)
on Mar 28, 2013 at 16:53 UTC ( #1025999=note: print w/replies, xml ) Need Help??


in reply to Re: Column Heading and Split Function
in thread Title of Column and Split Function

hmmm.
use File::Slurp; $_ = read_file(\*DATA); /$/mg; # skip first line my %rates = /^(\w+)\h+(\d+)/mg; $, = "\t"; print %rates; __DATA__ Patient Heart Rates Molly 70 Glenn 69

Replies are listed 'Best First'.
Re^3: Column Heading and Split Function
by McA (Priest) on Mar 28, 2013 at 17:46 UTC

    One more reduction and we have to put this node into Obfuscation... ;-)

    But while thinking it's interesting it deserves a ++

    McA

      <DATA>; # remove header line $/=undef; # instead of File::Slurp my %rates = split /\s+/, <DATA>; print map { "$_ $rates{$_}\n" } keys %rates; __DATA__ Patient Heart Rates Molly 70 Glenn 69
        $. > 1 and say join ' ', split while <DATA>;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025999]
help
Chatterbox?
[Happy-the-monk]: Discipulus: please, what are the labels for CTRL+SHIFT+TAB on an Eatalian keyboards?
[Discipulus]: yes but ireally do not understand anonymous's reply about cpan r command: found no bug with that number and points to mjd.. doh?!
[Discipulus]: Happy-the-monk CTRL is the same. SHIFT is a big fat arrow pointing up. TAB are two opposite arrows on each other pointing left/rigth

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2017-11-21 10:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (297 votes). Check out past polls.

    Notices?