SPUG: reg pattern matching in a loop

Ramon Hildreth ramonred at gmail.com
Fri Oct 14 12:35:38 PDT 2011


Esteemed colleges, I have recently re-opened my mental archives and am
attempting to create some scripts at work using perl to create some
utilities we need for our Lawson system.  I am having trouble with doing a
pattern match/substitution by line in a while loop -

........

open (OUTPUT, ">>$OUTPUTFILE");

while (<INPUT>)
{
        $_ =~ s/ \ +/|/;
        print OUTPUT "$PRODUCTLINE $_";
}
..........

my code works fine without the substitution listed above the print
statement, what I'm attempting to do it for each line is to remove all
spaces and replace with a pipe (|) - when I do leave this bit a code it, it
appears to be ignored.  I done a lot of googling and dusting off copies of
perl books, but so far no luck in the context I'm working with.  Any help
would be greatly appreciated.

Thank You.

Ramon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/spug-list/attachments/20111014/7ff2d8dd/attachment.html>


More information about the spug-list mailing list