in reply to Re^5: RESOLVED!!!
in thread remove line break from 1 line

Well hey, if it's working, what's to fix? But if it were my script, and the purpose is simply to make sure that two particular lines from an input file become a single line in the output file, I'd do something like this in the "Wanted" function: read the input one line at a time and push each one onto an array, if the current line matches the special pattern, attach the next line to it, and when all the input lines have been read in, write the set to a new output file if that line-joining logic actually applied (if it didn't, no need to rewrite the file).
sub Wanted { if ( !/\S\.html?$/i ) { warn "$root$File::Find::name skipped\n"; } elsif ( !open( IN, "<", $_ )) { warn "open for read failed on $root$File::Find::name : $!\n"; } else { my @lines = (); my $line; my altered = 0; while ( defined( $line = <IN> )) { if ( $line =~ /<meta\s+name="revision"\s+content=\s*$/i ) +{ $line =~ s/\s*$//; $line .= <IN>; $altered++; } push @lines, $line; } close IN; if ( $altered ) { open( OUT, ">", $_ ) or die "open for write failed on $roo +t$File::Find::name : $!\n"; print OUT @lines; ## NB: no need for quotes here close OUT; } warn "$root$File::Find::name finished with $altered changes\n" +; } }
(untested)

That assumes you can redirect STDERR to a file, which any decent shell can do (e.g. ksh or bash, both available for ms-windows), to keep all the "warn" outputs for logging. Or you can open a log file in the main routine and always print the logging messages to that. If you just push them onto an array like you were doing (to be printed when the find() function finished), none of the log data would get written in the event of a "die" condition.

Note that when you print an array like this: print "@array" the quoting will normally cause a space character to be inserted between the elements of the array, and you might not want that.