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:
&#8745;&#9559;&#9488;<?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>

In reply to Re: Mac Space in Path by fishmonger
in thread Mac Space in Path by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.