in reply to sending arguements to external program

The argument passing code is right. Are you sure that your program will accept more than one file at a time?

To test your script I used the Unix cat command like this:

#!/usr/bin/perl -w use strict; my @array = ('test.pl', 'b64.pl'); my @output = `cat @array`; print @output;

If your program only accepts one file on the command line then you'll need to do something more like this:

#!/usr/bin/perl -w use strict; my @array = ('test.pl', 'b64.pl'); my @output; foreach (@array) { push @output, `cat $_`; } print @output;
--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me

Replies are listed 'Best First'.
RE: RE: sending arguements to external program
by Anonymous Monk on Nov 09, 2000 at 18:45 UTC
    I feel that i was misunderstood .. sorry. THe array contains the contents of the file, not the file name itself ...
      So you're trying to pass the contents of the file as an argument to your program? That's not going to work unless the contents of the file are small and suitable to be passed on the command line. Otherwise, consider using pipes (see perlipc) and sending the data to the other program some other way. Like I said above, this works for me:
      @array = ("file1", "file2"); @output = `cat @array`; # @output now has the output of that command
      Either you did not explain your problem correctly, something is not as you say it is (check assumptions), or something is screwey with your particular system.

      Either way, if @array had a large amount of data in it, I would still not expect the error message you received. Be sure you're using strict and running Perl with the -w flag turned on (or 'use warnings' in 5.6). This might point you in the direction of the problem.