There's no need to use no warnings 'uninitialized';---just initialize the array. Remember, too, that the 1st arg to each must be a hash.
I tried your script in a slightly different way. I used a hash because I wanted to keep each.Outputs:#!/usr/perl/bin/perl use Modern::Perl; $|=1; my($data) = '/root/Desktop/inputfile.txt'; open STDIN, '<', $data or die "File error: input file: $!"; open STDOUT, '>', '/root/Desktop/output.log' or die "File error: output file: $!"; my(%result) = (); while (defined($_ = <STDIN>)) { chomp $_; my ($index, $value) = split( /\s/, $_, 0 ); $result{$index} = $value; } while (my ($index, $value) = each(%result)) { do { say "$index => $value" if $value > 500; }; } close STDIN; close STDOUT;
5 => 550
In reply to Re: outputing specific co-ordinates
by Khen1950fx
in thread outputing specific co-ordinates
by Taylorswift13
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |