in reply to Re: Array for system() call
in thread Array for system() call
To elaborate further, use this (note double quotes): system("@Call"); instead of this: system(@Call); to achieve the same effect as your first fragment.
And, BTW, you probably meant to do this:
$Call[0] = "gawk"; $Call[1] = "-f"; $Call[2] = "test.gawk"; $Call[3] = "test.file"; $Call[4] = ">"; $Call[5] = "out.file";
or (slightly more efficiently) this:
@Call = ( "gawk", "-f", "test.gawk", "test.file", ">", "out.file" );
rather than your original code, which is assigning values to 1-element array slices, which are sublists -- NOT arrays! -- of references to the elements of the @Call array; needless to say, although it works, it is somewhat less efficient than either of the above approaches, and bad practice besides.
dmm
Give a man a fish and you feed him for a day ... Teach the man to fish and you feed him for a lifetime
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re (2): Array for system() call
by blakem (Monsignor) on Oct 23, 2001 at 22:45 UTC | |
by dmmiller2k (Chaplain) on Oct 23, 2001 at 23:46 UTC |
In Section
Seekers of Perl Wisdom