Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Giving the input file to XMLin() from the command line as an argument

by Eliya (Vicar)
on Jan 24, 2012 at 12:36 UTC ( [id://949670]=note: print w/replies, xml ) Need Help??


in reply to Giving the input file to XMLin() from the command line as an argument

XMLin('$ARGV[0]/system.xml')

That should work just fine if you use double quotes instead of single quotes.  (Single quotes don't interpolate...)

As for passing a file handle, you can say

my $parser = XML::Simple->new(); my $data = $parser->XMLin($fh); # or my $data = $parser->XMLin(\*FH);

where $fh is a lexical file handle (i.e. open my $fh, ...), or an IO::File file handle, and \*FH is a ref to an old-style glob file handle.

Replies are listed 'Best First'.
Re^2: Giving the input file to XMLin() from the command line as an argument
by uday_sagar (Scribe) on Jan 25, 2012 at 06:09 UTC
    Thanks a lot Eliya! Its working and cool!!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://949670]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-26 03:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found