you to remove repetitions and maintain a single sample!
-----------------------------------------------------------------------------------------------------------
#!/usr/bin/perl
use strict;
use warnings;
various boot
=cut # commeted
my %hash;
$hash{1}='hard';
$hash{1}='soft';
$hash{1}='hard';
$hash{1}='soft';
$hash{2}='perl';
$hash{2}='linux';
$hash{2}='perl';$hash{2}='linux';
=cut
my %hash=('hard'=>'1',
'soft'=>'2',
'hard'=>'3',
'soft'=>'4',
'perl'=>'5',
'linux'=>'6',
'perl'=>'7',
'linux'=>'8');
my %hashTmp;
foreach my $key (keys %hash){
if(exists $hashTmp{$key}){
next;
}else{
$hashTmp{$key} = $hash{$key};
print "single sample - $key\n";
}
}
$perl command_line.pl
single sample - perl
single sample - soft
single sample - linux
single sample - hard
single sample - soft
single sample - linux
single sample - hard
0 comentários:
Post a Comment