steph_bow has asked for the wisdom of the Perl Monks concerning the following question:
1 A 0 B 3 C 0 A 2 C 5 A 3 E 1 E
6 A 0 B 5 C 4 E
#!/usr/bin/perl use strict; use warnings; ################################## ## ARGUMENTS OF THE SCRIPT ################################## # the argument due to be used is # the ALL_FT file ##################################### # do not forget the $ before the ARGV ##################################### # the format of the ALL_FT file has to be : $date.ALL_FT (ex: 20060904 +.ALL_FT) my $ALL_FT_file = "$ARGV[0]"; ################# END OF THE DECLARATION OF THE ARGUMENTS my $Current_Dir = `pwd`; # print STDOUT "the current directory is $Current_Dir"; # name of the OUTFILE # the day appears in the name of the OUTFILE my $day = $ALL_FT_file; # the following command is used to skip the .ALL_FT in the name of the + ALL_FT_file # and thus to have the date $day =~ s/.ALL_FT//; # open the ALL_FT file open(INFILE,"<delay_${day}.csv") or die "Can't open : delay_${day}.csv +: $!"; # to open the file # OUTFILE is the name of the HANDLE in this case open (OUTFILE, ">unique_delay_${day}.csv") ; # creation of a table my @New_Table; while (<INFILE>) { # the lines are composed of elements separated by a point comma my $Line = $_; chomp($Line); my @Elements = split(";", $Line); push(@New_Table, $Elements[2]); } print @New_Table; my %Hash = map { $_, 1 } @New_Table; my @unique = keys %Hash; close INFILE; close OUTFILE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: suppress the elements that appear more than one time in a list
by FunkyMonk (Bishop) on Aug 01, 2007 at 12:12 UTC | |
by steph_bow (Pilgrim) on Aug 01, 2007 at 12:54 UTC | |
by johngg (Canon) on Aug 01, 2007 at 13:05 UTC |