in reply to outputing specific co-ordinates
no warnings qw /uninitialized/;
I guess you've put it specially to silence the exact warning that tells you where the error is. You're splitting on "\t", but looking onto your input I have the impression that there are no tabs. So $value in
next if $value > 500;is probably uninitialized.
Update: well, after looking more closely I think real input contains tabs, but then it should work (to some extent). I think it is was a rather weird idea to keep coordinates in array like you did, e.g. you don't have 0 element, and some others may be missing. Here's a simplified version:
#!/usr/bin/perl use Modern::Perl; while (<DATA>) { chomp; my ($index, $value) = split /\s/; say "$index\t$value" if $value <= 500; } __DATA__ 1 10 2 11 3 9 4 500 5 550
Update: removed unused var
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: outputing specific co-ordinates
by Taylorswift13 (Novice) on Nov 19, 2011 at 09:45 UTC |