in reply to subroutines and arguments

And not directly related to your problem, but ALWAYS CHECK THE RETURN VALUE FROM open!

open( SERVERLST, "<", "svr_daily.csv" ) or die "Can't open server dail +y CSV: $!\n";

Replies are listed 'Best First'.
Re^2: subroutines and arguments
by jhourcle (Prior) on Apr 05, 2005 at 01:19 UTC

    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);
      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.