This is kind of related to an ealier post. I've successfully deleted the line break, but then i end up with some extra spaces.EX:
<meta name="revision" content= "Mon, 05 Jul 2006 23:59:59 GMT"
So, I tired this... but it ignores my switch (3rd nested if)
#!C:\Perl\bin\perl.exe use strict; use File::Find; use File::Slurp; use Time::Local; print "\nRunning ... \n\n"; my $root = "C:/"; # use forward slash, you can use mapped drives. print "changing to $root\n"; chdir $root; my $no_switches=0; my $no_files=0; my @log = (); my $dir; # find (\&Wanted, "department", "managers", "mybranch", "mycity", "myi +nfo", "resources"); find (\&Wanted, "working"); #directories - comman delimited sub Wanted { print "*Processing: $root$File::Find::name \n"; if ($_ =~ /\.htm(l)?$/i) { open(xFILE, $_) or die "ERROR: couldn't open file"; my @file = <xFILE>; foreach my $line (@file) { close (xFILE); if ($line =~ m/<meta[\s\r\n\t]+name="revision"[\s\r\n\t]+conte +nt=[\n]+/i) { open(FILE, ">$_") or die "ERROR: Can't open $_"; chomp($line); if ($line =~ m/(<meta[\s\r\n\t]+name="revision"[\s\r\n\t]+c +ontent=)([\s]+)(.*>)/i) { my $newline = $1.$3; $line =~ s/$line/$newline/; print "Switched: $newline\n"; } print FILE "@file"; # @file array is entire file. close (FILE); print "file overwritten\n"; push @log,"$root$File::Find::name \n\n"; $no_switches++; } # end if } # end for loop $no_files++; } #end if matches filetype else { print "file type not processed\n\n"; } #add $_ if you want + to see URL of file not processed. } # end sub
Forget it... it's only 1 line after the chomp. I need to do 2 passes

In reply to Remove line break, then remove spaces (resolved) by djbryson

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.