Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: outputing specific co-ordinates

by zwon (Abbot)
on Nov 19, 2011 at 09:01 UTC ( [id://938953]=note: print w/replies, xml ) Need Help??


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

    Excellent works great and i understand it! thanks

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://938953]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-25 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found