I think we need a little more info/context.
How are you executing the script?
Are you passing the file path as a command line arg, or is it in a file that is passed as an arg or piped to the script?
Did you try dumping out $metadata_file (via Data::Dumper) prior to the open call to see if it held the value you expected?
There's no need to quote $metadata_file in the open call as demonstrated in the following example
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my $filepath = 'C:\Program Files\Internet Explorer\ie9props.propdesc';
open my $fh, '<', $filepath or die "can't open '$filepath' $!";
my $file_contents = join '', <$fh>;
print $file_contents;
outputs:
<?xml version="1.0" encoding="utf-8"?>
<!--
The properties in this file cover the following:
Microsoft.IE.*
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="h
+ttp://schemas.microsoft.com/windows/2006/propertydescription" schemaV
+ersion="1.0">
<propertyDescriptionList publisher="Microsoft" product="Internet E
+xplorer">
<propertyDescription name="Microsoft.IE.FeedItemLocalId" forma
+tID="{E32596B0-1163-4E02-867A-12132DB4BA06}" propID="2">
<searchInfo inInvertedIndex="false" isColumn="true" maxSiz
+e="256"/>
<typeInfo type="String" isViewable="false"/>
</propertyDescription>
<propertyDescription name="Microsoft.IE.SelectionCount" format
+ID="{1CE0D6BC-536C-4600-B0DD-7E0C66B350D5}" propID="2">
<searchInfo inInvertedIndex="false" isColumn="true"/>
<typeInfo type="UInt32" isViewable="false"/>
</propertyDescription>
<propertyDescription name="Microsoft.IE.TargetUrl" formatID="{
+1CE0D6BC-536C-4600-B0DD-7E0C66B350D5}" propID="3">
<searchInfo inInvertedIndex="true" isColumn="true" maxSize
+="4168"/>
<typeInfo type="String" isViewable="false" isQueryable="tr
+ue"/>
</propertyDescription>
<propertyDescription name="Microsoft.IE.TargetUrlHostName" for
+matID="{1CE0D6BC-536C-4600-B0DD-7E0C66B350D5}" propID="4">
<searchInfo inInvertedIndex="true" isColumn="true" maxSize
+="512"/>
<typeInfo type="String" isViewable="false" isQueryable="tr
+ue"/>
</propertyDescription>
<propertyDescription name="Microsoft.IE.TargetUrlPath" formatI
+D="{1CE0D6BC-536C-4600-B0DD-7E0C66B350D5}" propID="5">
<searchInfo inInvertedIndex="true" isColumn="true" maxSize
+="4168"/>
<typeInfo type="String" isViewable="false" isQueryable="tr
+ue"/>
</propertyDescription>
<propertyDescription name="Microsoft.IE.Title" formatID="{1CE0
+D6BC-536C-4600-B0DD-7E0C66B350D5}" propID="6">
<searchInfo inInvertedIndex="true" isColumn="true" maxSize
+="4168"/>
<typeInfo type="String" isViewable="false" isQueryable="tr
+ue"/>
</propertyDescription>
<propertyDescription name="Microsoft.IE.VisitCount" formatID="
+{1CE0D6BC-536C-4600-B0DD-7E0C66B350D5}" propID="7">
<searchInfo inInvertedIndex="false" isColumn="true"/>
<typeInfo type="UInt32" isViewable="false"/>
</propertyDescription>
</propertyDescriptionList>
</schema>
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|