Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: How to print months in proper order from array

by Not_a_Number (Prior)
on Aug 31, 2016 at 08:55 UTC ( [id://1170853]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to print months in proper order from array
in thread How to print months in proper order from array

Another way, avoiding any sorting:

use strict; use warnings; use 5.010; my @month_names = ( qw / January February March April May June July August September October November December / ); my %month_hash; while ( my $line = <DATA> ) { $month_hash{$_} = 1 for split /[^a-z]+/i, $line; } for ( @month_names ) { say if $month_hash{$_}; } __DATA__ IBM | February 1 March 5 July 4 Oracle| January 3 March 4 April 6 May 5 RedHat | March 2 June 3 August 1

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1170853]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-19 17:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found