Why can't my Perl script in ~/bin find relative file paths?

Posted by sid_com on Super User See other posts from Super User or by sid_com
Published on 2010-04-23T13:13:48Z Indexed on 2010/04/24 5:03 UTC
Read the original article Hit count: 173

Filed under:
#!/usr/bin/env perl
use warnings; 
use strict;
use XML::LibXML;

my $parser = XML::LibXML->new;
my $file = './example.xml';
my $doc = $parser->parse_file( $file );
print ref( $doc ), "\n";

When I move this script and the example.xml-file to /home/me/ then the script works. When I move the script and the example.xml-file to /home/me/bin/ then the script doesn't find the example.xml-file. Is this some special-feature of the bin-directory?

© Super User or respective owner

Related posts about perl