Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

xml parsing error

by satzbu (Acolyte)
on Sep 03, 2010 at 05:52 UTC ( [id://858670]=perlquestion: print w/replies, xml ) Need Help??

satzbu has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks i m trying to parse an xml file using XML::Twig unfortunately my code shows this error please help me to clear this error

#!/usr/bin/perl use warnings; use strict; use Data::Dumper; use XML::Twig; my @xhash=(); my $xhash=\@xhash; my $file= $ARGV[0]; $xhash = XML::Twig->new(); $xhash -> parsefile('$file'); $xhash -> print;
ERROR: Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\BISADMIN>e: E:\>cd fh\demo E:\FH\Demo>cd 1-9demo E:\FH\Demo\1-9demo>perl hashreplace.pl Ch01.xml Couldn't open $file: No such file or directory at hashreplace.pl line 10 at hashreplace.pl line 10 E:\FH\Demo\1-9demo>_END_

but the file is on the folder only please tel what is the reason for this error and help me to fix this problem

Replies are listed 'Best First'.
Re: xml parsing error
by ikegami (Patriarch) on Sep 03, 2010 at 05:59 UTC
    You're passing the 5 character string $,f,i,l,e. You surely intended to pass the contents of the variable $file instead.
Re: xml parsing error
by murugu (Curate) on Sep 03, 2010 at 12:06 UTC
    From the error itself you can see that, it tries to open '$file'. parsefile($file) should clear this error.

    Regards,
    Murugesan Kandasamy
    use perl for(;;);

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-19 20:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found