Re: Replace last # with \n

2002-07-23 Thread Jeff 'japhy' Pinyan
On Jul 23, John W. Krahn said: >Rich Busse wrote: >> >> I want to replace the last "#" with a newline. I've come up with a few ideas > >$_ = reverse; >s/#/\n/; >$_ = reverse; Here's a (potential) Perl 5.8.1 way of doing it, which is likely to be faster than the sexeger (reversing approach above)

Re: Replace last # with \n

2002-07-23 Thread John W. Krahn
Rich Busse wrote: > > 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"

FW: Replace last # with \n

2002-07-23 Thread Busse, Rich
Doh! I forgot about using $! All I need is s/#$/\n/ ; Thanks to Tor & Tanton for getting my brain in gear... > -Original Message- > From: Busse, Rich > Sent: Tuesday, 23 July, 2002 09:00 > To: 'Perl Beginners' > Subject: Replace last # with

Re: Replace last # with \n

2002-07-23 Thread Tanton Gibbs
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 l

Re: Replace last # with \n

2002-07-23 Thread Tor Hildrum
<[EMAIL PROTECTED]> wrote: > 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)

Replace last # with \n

2002-07-23 Thread Busse, Rich
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) =