Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^4: If any element-in-array comparision

by naturalsciences (Beadle)
on Jan 27, 2012 at 16:51 UTC ( #950415=note: print w/replies, xml ) Need Help??

in reply to Re^3: If any element-in-array comparision
in thread If any element-in-array comparision

well my own code was like this.
#!/usr/bin/perl -w use strict; use warnings; my @data=<>; foreach (@data) { my @row=split(/\t/, $_); my $otuhead=shift(@row); my $logic=1; foreach (@row) { if ($_>=0.01){$logic++;} } if ($logic!=1){print "$otuhead @row";} $otuhead=(); }

And yes I am acutely aware that the basic algorithm for finding out max, min etc. from a list has actually go through the list. I was just looking for utilities, commands, or whatnot that can make it well ... look nice would probably be the best explanation. Something that does not need extra curly brackets and extra declared variables. Extra space and hmm more general eyestrain. The question was more motivated by general curiosity than an actual need for this current problem. Which I have already solved (probably quite horribly as people soon will point out I guess :D)

edit: in code I shift off the first element -because it is a header and therefore not numerical.

Replies are listed 'Best First'.
Re^5: If any element-in-array comparision
by fisher (Priest) on Jan 27, 2012 at 17:07 UTC
    Well, ok, then, in addition to other's versions ++ mine:
    #!/usr/bin/env perl use strict; use warnings; my @akj = (0.11, 0.05, 0.02); print join ",", @akj if grep {$_>0.1} @akj;
      Well that's a quite nice and clean looking piece. Something like that I was looking for. Also looks like chessgui-s premonitions were right. :D

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://950415]
[choroba]: marto++ # if you're living in the cloud, you're going to get rained on
Corion discovers that ffmpeg is supposed to have audio fingerprinting built in already. Maybe the ffmpeg at home has that too. Then I could automate removing audio jingles from that one radio show I listen to :)

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2018-05-24 13:26 GMT
Find Nodes?
    Voting Booth?