I am getting the strange feeling that my undertaking of writing a "simple" script turns out to be a much larger project than I had anticipated.

Its not that much larger, its just that there is a lot of details :) Its like learning to sing in a new language, there is new sentence structure and new word list ... and you still have to practice hitting your notes :)(reading about it is different than doing it)

Think pre-teen versus a mother versus a car mechanic -- pre-teen probably knows that the wheels go round and round, mom knows when to drive for service, and mechanic knows how to replace parts (including what manual to read )

You're at the mom stage studying for mechanic -- you can get there if you're willing :) its just details

probably student driver stage trying to pass the written exam (analogies are hard:)

/bin/sh: gcc-4: Kommando nicht gefunden. Makefile:367: recipe for target 'Cwd.o' failed make: *** Cwd.o Error 127

Like Corion already said, looks like you're missing gcc-4 :)

Wide character in die at ... Path/Tiny. ... line 57 in the script

Isn't that wonderfully convenient? I think so (problem detected, error reported informatively)

So there is a problem with the filename, its got extra stuff. So, to solve the cause you work your way backwards, which function feeds RetrieveAndBackupXML? Which function feeds that function? Is it still called GetPaths? That is where you employ File::BOM, like

sub GetPaths { use File::BOM; ## my @paths = path( shift )->lines_utf8; my @paths = path( shift )->lines( { binmode => ":via(File::BOM)" } + ); s/\s+$// for @paths; # "chomp" return @paths; } ## end sub GetPaths

other way without File::BOM

sub GetPaths { my @paths = path( shift )->lines_utf8; s/\x{feff}//g for @paths; # "de-bom" s/\s+$// for @paths; # "chomp" return @paths; } ## end sub GetPaths

A tip: if you add use Carp::Always; you will get a stack of error messages, like

use Carp::Always; use Path::Tiny qw/ path /; sub f{g(@_);} sub g { r( @_ ); } sub r { path(shift)->lines } f(666); __END__ Error open (<) on '666': No such file or directory at C:/citrusperl/si +te/lib/Path/Tiny.pm line 1469. Path::Tiny::Error::throw('Path::Tiny::Error', 'open (<)', 666, 'No + such file or directory') called at C:/citrusperl/site/lib/Path/Tiny. +pm line 126 Path::Tiny::_throw('Path::Tiny=ARRAY(0xabe0a4)', 'open (<)') calle +d at C:/citrusperl/site/lib/Path/Tiny.pm line 740 Path::Tiny::filehandle('Path::Tiny=ARRAY(0xabe0a4)', 'HASH(0xae824 +c)', '<', undef) called at C:/citrusperl/site/lib/Path/Tiny.pm line 9 +00 Path::Tiny::lines('Path::Tiny=ARRAY(0xabe0a4)') called at - line 5 main::r(666) called at - line 4 main::g(666) called at - line 3 main::f(666) called at - line 6
makes it more obvious what sub feeds the dying one

In reply to Re^12: search and replace strings in different files in a directory by Anonymous Monk
in thread search and replace strings in different files in a directory by PitifulProgrammer

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.