neo80123 wrote:
Hi,
Hello,
can anyone help me out?
Maybe, it depends on how well you describe your problem.
Code:
You should start your code with the two pragmas: use warnings; use strict;
foreach(@unsort) { ( $Sip, $Spo, $Dip, $Dpo, $Prot, $Dir ) = split( ',' );
You are extracting six fields but below you say that your data only contains five fields?
foreach(@unsort) { if (index($_,$Sip)>-1 and $Dir==0) { $unsort[0] =~ s/$Sip//; $countout++; next; } elsif (index($_,$Sip)>-1 and $Dir==1) { $unsort[0] =~ s/$Sip//; $countin++; next; } else { next; } } if ($countout==0){$countout=1;} if ($countin==0) {$countin=1;} $TopOut{$Sip}=$countout; $TopIn{$Sip}=$countin; } The input is sth like that "51,34,55,45.0" or "34,45,123,55,0". I want
Shouldn't that first string be "51,34,55,45,0"? And where does the $Dir field come from?
to find out how often Number 55 exists. No matter on what position the 55 is.
I don't see 55 in your code above? How do you determine that 55 exists?
In the above example the routine will make (depending on the size of @unsort) $unsort*$unsort transitions...
But what is it actually supposed to do?
that is too long because my @unsort has up to 50000 Elements.. Any ideas to accomplish it faster?
Yes. It would be helpful if you could provide a reasonable amount of input data and how and what you want the result(s) to look like.
John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/