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 \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]