Thank you so much for your help
The code worked fine, but curiosity got the better of me and I tried to find a way how specify both infile and outfile on the command line.
This was the point when I realised that I have not yet proper understood how functions and parameters work, especially how to pass arguments to a function. I guess it is back to books for me.
While reading the code, I was thinking that parsefile was the crucial element and this is where my infile should go through. However I could not establish the connection between parsefile and the $ofh open in the first lines.
However when I tried the new code I always got the following message:
.pm line 773. Couldn't open : No such file or directory at replace_tmx_ori.pl line 19. at replace_tmx_ori.pl line 19.
I figure the programm does not know which file is passed for input
Is there a possibility to specify the in and outfile in the code? Please find my endeavours below
Comments and explanations are appreciated.
my $infile = $ARGV[0]; my $outfile = $ARRGV[2]; open my $ofh, '>:utf8', $outfile or die $!; XML::Twig->new( keep_spaces => 1, twig_print_outside_roots => $ofh, twig_roots => { tu => sub { my ($twig, $elt) = @_; $elt->set_att('creationid',"Simon Simonsen"); $elt->print($ofh); } }, )->parsefile( $infile ); close $ofh;
Thanks a mil in advance for helping us noobs out here
kind regards C.In reply to Re^4: help with regular expression required
by PitifulProgrammer
in thread help with regular expression required
by PitifulProgrammer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |