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

Re: how to sort uniq $array[2]

by wind (Priest)
on Jun 05, 2011 at 21:57 UTC ( [id://908215]=note: print w/replies, xml ) Need Help??


in reply to how to sort uniq $array[2]

Please read How do I post a question effectively?.

Below is your code reformatted for others to be able to help you:

#!/usr/bin/perl -w use strict; find_serv (); sub find_serv { @ARGV == 2 || die "usage: $0 INDEX_FILE '.com'\n"; my ( $INDEX_FILE, $com ) = @ARGV; my $list = "grep 'href=' $INDEX_FILE|" ; open (my $HAN, "$list" ) || die "Cannot open '$INDEX_FILE' because +:: $!"; while (<$HAN>) { chomp $_; my @array = split (/\//, $_); if ($array2 =~ /$com/ ){ my $sorted = $array2; system (sort -u $scalar); # - doesn't work #print "$_\n" for sort { versioncmp($a,$b) } $sorted; } } } #END sorted file should look like www.google.ie www.icq.com www.....

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-03-29 01:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found