Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
i am try to put values in an array with STDIN after finishing putting the values i am trying to print the array and not success
this is my program:
and this is the error message that perl write me:#! /usr/bin/perl -w use strict; print "Enter 5 numbers: \n"; my $i=0; my @arr1=(); while (($i<=4) and (<>)) { @arr1 = (@arr1,$_); $i++; } my $m; foreach $m (@arr1) { print "$m \n"; }
use of uninitialized value in concatenation or string at ...path...lin +e 17,<> line 5.
2006-08-26 Retitled by g0n, as per Monastery guidelines
Original title: 'STDIN'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Input to array from STDIN, then print, but print is not working
by Tanktalus (Canon) on Aug 26, 2006 at 15:18 UTC | |
|
Re: Input to array from STDIN, then print, but print is not working
by imp (Priest) on Aug 26, 2006 at 15:35 UTC | |
|
Re: Input to array from STDIN, then print, but print is not working
by davido (Cardinal) on Aug 26, 2006 at 16:06 UTC | |
|
Re: Input to array from STDIN, then print, but print is not working
by GrandFather (Saint) on Aug 26, 2006 at 22:22 UTC |