Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Extracting non-consecutive but related items from an array.

by sapnac (Beadle)
on Jun 15, 2005 at 14:11 UTC ( [id://466922]=note: print w/replies, xml ) Need Help??


in reply to Re: Extracting non-consecutive but related items from an array.
in thread Extracting non-consecutive but related items from an array.

#use strict; use FileHandle; # Global Declaration my($spool,%serverdet); open (spooler ,"data.dat") or die "Error opening the file\n"; while($spool=<spooler>) { chomp($spool); ($server,$dat1,$dat2)=split(/,/,$spool); if($serverdet{$server}) { $serverdet{$server} .= ";".$dat1.",".$dat2; }else{ $serverdet{$server} = $dat1.",".$dat2; } } foreach $key (sort keys %serverdet) { print "Server $key\n"; @val = split(/;/,$serverdet{$key}); foreach $val (sort @val) { print $val."\n"; } }
Hope this helps!

code tags added by holli

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-18 02:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found