if you want to use s/// you can say

s/(.*)#/$1\n/;
----- Original Message -----
From: "Busse, Rich" <[EMAIL PROTECTED]>
To: "Perl Beginners" <[EMAIL PROTECTED]>
Sent: Tuesday, July 23, 2002 9:00 AM
Subject: Replace last # with \n


> I have a string that looks like
>
> Operator Overview#PGM#Report about all configured
> operators#/opt/OV/bin/OpC/call_sqlplus.sh all_oper#
>
> I want to replace the last "#" with a newline. I've come up with a few
ideas
> like
>
> substr ($_, rindex ($_, "#"), 1) = "\n" ;
> or
> substr ($_, length ($_) - 1, 1) = "\n" ;
> or
> chop ; $_ .= "\n" ;
>
> Are there any better ways, maybe using s/// or tr/// ? TIA...
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to