Actually you probably want something more like this:<br><br>� $_ =~ s/\s+/|/g;���� # this will substitute all multiple instances with a single pipe but if you actually want each space substituted you'd need $_ =~ s/\s/|/g;<br>
<br>Also when you want to avoid backslashitis you can do something like s#\s+#|#g�� which is kind of hard to read but it's basically s # \s+ # | # g; so just ignore the spaces <br>(of course there's a setting that ignores white space to i your expression as well).<br>
Even s{\s+}{|}g can be used.<br><br><div class="gmail_quote">On Fri, Oct 14, 2011 at 12:35 PM, Ramon Hildreth <span dir="ltr"><<a href="mailto:ramonred@gmail.com">ramonred@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<font color="#660000"><font size="2"><font face="tahoma,sans-serif">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 - <br>
<br>........<br><br>open (OUTPUT, ">>$OUTPUTFILE");<br><br>while (<INPUT>)<br>{<br>������� $_ =~ s/ \ +/|/;<br>������� print OUTPUT "$PRODUCTLINE $_";<br>}<br>..........<br><br>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. <br>
<br>Thank You. <br><font color="#888888"><br>Ramon<br></font></font></font></font>
Actually you probably want something more like this:<br><br>� $_ =~ s/\s+/|/g;���� # this will substitute all multiple instances with a single pipe but if you actually want each space substituted you'd need $_ =~ s/\s/|/g;<br>
<br>Also when you want to avoid backslashitis you can do something like s#\s+#|#g�� which is kind of hard to read but it's basically s # \s+ # | # g; so just ignore the spaces <br>(of course there's a setting that ignores white space to i your expression as well).<br>
Even s{\s+}{|}g can be used.<br><br><div class="gmail_quote">On Fri, Oct 14, 2011 at 12:35 PM, Ramon Hildreth <span dir="ltr"><<a href="mailto:ramonred@gmail.com">ramonred@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<font color="#660000"><font size="2"><font face="tahoma,sans-serif">Esteemed colleg
es, 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 - <br>
<br>........<br><br>open (OUTPUT, ">>$OUTPUTFILE");<br><br>while (<INPUT>)<br>{<br>������� $_ =~ s/ \ +/|/;<br>������� print OUTPUT "$PRODUCTLINE $_";<br>}<br>..........<br><br>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. <br>
<br>Thank You. <br><font color="#888888"><br>Ramon<br></font></font></font></font>