in reply to Can't figure out how to include LAST member of the array
How about adding a
after the for loop?print "M$End";
That is:
for (my $i=$Start; $i <= ($End-1) ; $i++){ print "M$i --> V$i-->"; } print "M$End";
But if I were doing this, I'd probably do it like so:
for (my $i=$Start; $i <= $End; $i++) { print "M$i"; print " --> V$i-->" unless $i == $End; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can't figure out how to include LAST member of the array
by perlynewby (Scribe) on Feb 09, 2021 at 20:59 UTC |