Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Perl text processing

by AnomalousMonk (Archbishop)
on Jun 09, 2014 at 17:14 UTC ( [id://1089292]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl text processing
in thread Perl text processing

Some untested thoughts:

open (...);

Return status of open statements not checked; alternately,  use autodie; not used.

$devices{$1}=0 if /^\s*(\d{8}$/;

Capture group  (\d{8}$ not closed.

my $imeitag=$1 if /^\s*(\d{8}\d+\s*$/

Capture group  (\d{8}\d+\s*$ not closed; statement not terminated (missing semicolon);  my $imeitag ... if ... ; conditional creation of lexical (pre-state static variable hack).

for my $imeitag (sort {$devices{$a}<=>$devices{$b}} keys %devices){
    print "$imeitag\n";
    $count++;
    last if $count >=100;
}

Sorts keys of hash in ascending numerical order, but then prints first 100 keys, which does not seem in accord with requirement to "output ... the top 100 devices" (whatever "top" may exactly mean in the context of the OP).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-19 00:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found