in reply to number array with space
Hi MynameisAchint,
To really get the help you want it will be wonderful if you follow the advice giving in How do I post a question effectively?.
...I wish to run a for loop for that array...
Instead of using a for loop as used in C, why not use for/foreach as Perl like thus:
Update:my @array_data = qw( 21 45 perl 28 monks); foreach my $data (@array_data){ print $data,"\n"; }
my @array_data = (21,45,'perl',28,'monks',' ','togo'); for my $num (0..$#array_data){ print $num,': ',$array_data[$num],"\n"; }
Please, note that I used foreach and for inter-changeably.0: 21 1: 45 2: perl 3: 28 4: monks 5: 6: togo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: number array with space
by CountZero (Bishop) on Jun 20, 2013 at 06:15 UTC | |
by 2teez (Vicar) on Jun 20, 2013 at 06:21 UTC | |
by MynameisAchint (Novice) on Jun 20, 2013 at 06:51 UTC | |
by davido (Cardinal) on Jun 20, 2013 at 07:00 UTC | |
by 2teez (Vicar) on Jun 20, 2013 at 07:09 UTC | |
by davido (Cardinal) on Jun 20, 2013 at 07:28 UTC | |
by MynameisAchint (Novice) on Jun 20, 2013 at 07:59 UTC | |
|