in reply to Passing an array, or not? MIME::Lite
Your code does not pass perl -c. That line with if shall be:
if ($counter >= 1) {$message += $inline . "\n"};
"my $counter = 0; foreach my $inline (@ARGV) { if ($counter >= 1) $message += $inline . "\n"; ++$counter; #a wasting, although not a big one ;-) }"
Looks like the whole purpose of using $counter is to skip the first element, why not just:
for my $index (1 .. $#ARGV) { $message += $ARGV[$index] . "\n"; }
Now why you skip the first element? Try this:
use strict; use warnings; for my $index (0 .. $#ARGV) { print $ARGV[$index] . "\n"; }
Run it with perl -w blah.pl msg1 msg2 msg3, the output is:
msg1 msg2 msg3
What are you try to skip ;-?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Passing an array, or not? MIME::Lite
by invisible_ink (Initiate) on Oct 11, 2004 at 23:01 UTC |