> The problem is that the second part of the substitution (HI) is not
> taken as a regex, but as a string, which is to mean that you're trying
> to replace "\n" with "HI\n".
> 
> If you were using
> 
> s/
>  (\n)
> /HI/xisg;
> 
> instead, you wouldn't have that problem.
> 
> 
> Now that we've been through the problem, let me tell you 
> about an easier
> way to do it:
> 
> s/\n/HI/g;
> 
> There :-) Much simpler, isn't it? :-)
> 

Without wanting to sound like a wiseguy, wouldnÂt this be even simpler:

  chomp;

If you want to strip more than the \n, a regex would be more appropriate,
but if youÂre talking about the trailing newline only, chomp might be the
easiest (and probably fastest) solution.

Just my 5 cent,

Philipp

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to