CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
System command and vector as input



Sep 10, 2010, 3:02 AM

Post #1 of 3 (5335 views)
System command and vector as input Can't Post

Hello .

I am trying to use system command to perform a particular task on a group of input files; When I provide the file nales one by one my code works but if I want to provide the file names as a vector it fails.

@resultad is a vector containg filepath/name. Do you know what the problem is please? I checked the code and I am sure it does not recieve the files (@resultad) ...

system("perl @resultad $data_fileOut");

In perl my code starts with :

use XML::Simple;
use Data::Dumper;
# create object
$xml = new XML::Simple(KeyAttr=>[]);
print "# of input files = $size \n"

the error :

# of input files = 0
Can't open result.txt!
/tsi/yacast/20100323/Annotations/2010/03/15/165038/Advertising.xml: line 1: syntax error near unexpected token `newline


Sep 10, 2010, 5:33 AM

Post #2 of 3 (5322 views)
Re: [yasdel] System command and vector as input [In reply to] Can't Post

You show a part of your program, but you don't show that part where the error occurs. From the message, I would guess that XML::Simple is complaining about an incorrect XML file, so maybe you should have a look at this file using a hex editor.


Sep 10, 2010, 6:46 AM

Post #3 of 3 (5315 views)
Re: [yasdel] System command and vector as input [In reply to] Can't Post

How does parse the command line? The scalar $data_fileOut is not always in the same place.

Does work with a vector on the command line?

Your argument to system is a single string. Try storing that string in a variable and examine that variable with Data::Dumper to prove that it contains exactly what you think.

Are there any special characters in your file names (e.g. whitespace or backslash)? This causes big problems with system on windows, but usually not on other operating systems.
Good Luck,


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives