in reply to Grab Current Line of SVG File

You could try something like this:
opendir( my $dir, $dirname ); my @in = grep { /^[^.]/ && -f "$dirname/$_" } readdir( $dir ); closedir $dir; for my $file (@in) { open( my $infile, '<', "$dirname/$file" ) or next; open( my $outfile, '>', "$outdirname/$file" ) or die "can't open f +ile output/$file: $!"; while ( my $line = <$infile> ) { $line =~ s/rotate\(-180/rotate\(-0/g; if ( $line =~ m/$target/ ) { for my $key (keys %stroke_width_hash) { $line =~ s/$key/$stroke_width_hash{$key}/g; } } print $outfile $line; } close $outfile; close $infile; }

Replies are listed 'Best First'.
Re^2: Grab Current Line of SVG File
by beginAgain (Novice) on Apr 17, 2019 at 16:26 UTC
    Thank you for replying :) - I have solved it with something mentioned by another poster - see my comments