in reply to Re: subroutines and arguments
in thread subroutines and arguments

And while you're at it, don't pass a single argument to system, either. Especially if you're passing in stuff from a file. (I'd recommend checking the lines from the file, even with the following changes):

open (SERVERLST, '<', 'svr_daily.csv') or die "Can't read from server daily CSV: $!"; foreach my $svr (<SERVERLST>) { chomp $svr; ls_engine($svr); } sub ls_engine { my $ls_eng = shift; system qw(wdmlseng -e), $ls_eng; }

Update: per Fletch, fixed the mistake w/ qw(). Had previously been:

system qw(wdmlseng -e $ls_eng);

Replies are listed 'Best First'.
Re^3: subroutines and arguments
by Fletch (Bishop) on Apr 05, 2005 at 03:07 UTC
    perl -le 'print for qw( $erm $do $you $really $want $qw? )'

    Remember qw() is a compile time construct. But yes, if you're not sure about the pedigree of the contents of the file you don't want to pass a single scalar to system.

    Update: Not to mention that qw() is equivalent to split(' ', q/STRING/) to begin with and hence wouldn't do any interpolation.