s/// w/o RE

2004-04-14 Thread Bryan Harris
A quick question for the wizards-- Is it possible to do a substitution without compiling the pattern at all? ** #!/usr/bin/perl $ss = "cool???"; $rs = "cool."; $_ = "Perl is really cool???"; s/$ss/$rs/g; print "$_\n"; **

Re: s/// w/o RE

2004-04-14 Thread James Edward Gray II
On Apr 14, 2004, at 2:06 AM, Bryan Harris wrote: A quick question for the wizards-- Will I do? Is it possible to do a substitution without compiling the pattern at all? Sure. ** #!/usr/bin/perl $ss = "cool???"; $rs = "cool."; $_ = "Perl is really cool???"; s/

RE: s/// w/o RE

2004-04-14 Thread Jayakumar Rajagopal
-Original Message- From: Bryan Harris [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 14, 2004 3:07 AM To: Beginners Perl Subject: s/// w/o RE A quick question for the wizards-- Is it possible to do a substitution without compiling the pattern at all

Re: s/// w/o RE

2004-04-14 Thread Wiggins d Anconia
> > > A quick question for the wizards-- > > Is it possible to do a substitution without compiling the pattern at all? > > ** > #!/usr/bin/perl > > $ss = "cool???"; $ss = "\Qcool???\E"; > $rs = "cool."; > $_ = "Perl is really cool???"; > s/$ss/$rs/g; > pr

Re: s/// w/o RE

2004-04-14 Thread u235sentinel
Wouldn't it be this instead? substr $_, index($_, $ss), length($ss) = $rs; I was looking up substr and didn't see a fourth parameter. Didn't have a chance to try it either :-) Thx > On Apr 14, 2004, at 2:06 AM, Bryan Harris wrote: > > > > > A quick question for the wizards-- > > Will I do?

Re: s/// w/o RE

2004-04-14 Thread James Edward Gray II
On Apr 14, 2004, at 1:47 PM, [EMAIL PROTECTED] wrote: Wouldn't it be this instead? substr $_, index($_, $ss), length($ss) = $rs; Same thing. I was looking up substr and didn't see a fourth parameter. Really? It's the top signature in the docs. James -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: s/// w/o RE

2004-04-14 Thread John W . Krahn
On Wednesday 14 April 2004 11:47, [EMAIL PROTECTED] wrote: > > > On Apr 14, 2004, at 2:06 AM, Bryan Harris wrote: > > > > The above line could also be written: > > > > substr $_, index($_, $ss), length($ss), $rs; > > Wouldn't it be this instead? > > substr $_, index($_, $ss), length($ss) = $rs; Th

Re: s/// w/o RE

2004-04-14 Thread James Edward Gray II
On Apr 14, 2004, at 2:19 PM, John W. Krahn wrote: On Wednesday 14 April 2004 11:47, [EMAIL PROTECTED] wrote: On Apr 14, 2004, at 2:06 AM, Bryan Harris wrote: The above line could also be written: substr $_, index($_, $ss), length($ss), $rs; Wouldn't it be this instead? substr $_, index($_, $ss

Re: s/// w/o RE

2004-04-14 Thread u235sentinel
> > That won't work. Because of precedence it evaluates to: > > > > substr $_, index($_, $ss), ( length($ss) = $rs ); Ok. I get it now. Didn't realize I was doing that :D > perldoc -f substr I was looking it up in the "Learning Perl 3rd" edition. /me slaps Oreilly Still a great book. Sho

Re: s/// w/o RE

2004-04-14 Thread James Edward Gray II
On Apr 14, 2004, at 2:44 PM, [EMAIL PROTECTED] wrote: That won't work. Because of precedence it evaluates to: substr $_, index($_, $ss), ( length($ss) = $rs ); Ok. I get it now. Didn't realize I was doing that :D perldoc -f substr I was looking it up in the "Learning Perl 3rd" edition. /me s

Re: s/// w/o RE

2004-04-14 Thread Bryan Harris
> perldoc perlre for more: > > "\Q quote (disable) pattern metacharacters till \E" Wow, there really are wizards here! After 2+ years of perl, I still learn stuff almost every day. I'd never heard of this one before... Thanks all. - Bryan -- To unsubscribe, e-mail: [EMAIL PROTECTED] Fo

Re: s/// w/o RE

2004-04-14 Thread Wiggins d'Anconia
Bryan Harris wrote: perldoc perlre for more: "\Q quote (disable) pattern metacharacters till \E" Wow, there really are wizards here! After 2+ years of perl, I still learn stuff almost every day. I'd never heard of this one before... So do I after 7 years ;-)... http://danconia.org -- To un

Re: s/// w/o RE

2004-04-15 Thread Randal L. Schwartz
> "Wiggins" == Wiggins D'Anconia <[EMAIL PROTECTED]> writes: Wiggins> So do I after 7 years ;-)... And I after twice that. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Tec

Re: s/// w/o RE

2004-04-15 Thread Bryan Harris
> Wiggins> So do I after 7 years ;-)... > > And I after twice that. Hey, perl hasn't been around for quite 21 years! - B -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: s/// w/o RE

2004-04-15 Thread Randy W. Sims
On 4/15/2004 11:56 PM, Bryan Harris wrote: Wiggins> So do I after 7 years ;-)... And I after twice that. Hey, perl hasn't been around for quite 21 years! err, my math must be rusty: twice 7 years != 21 Randy. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EM

perl almost an adult? [was: s/// w/o RE]

2004-04-15 Thread Bryan Harris
>>> Wiggins> So do I after 7 years ;-)... >>> >>> And I after twice that. >> >> Hey, perl hasn't been around for quite 21 years! > > err, my math must be rusty: twice 7 years != 21 Oops, sorry, my undiagnosed dyslexia is acting up -- I read it three times, and each time it said "And I twice a

Re: perl almost an adult? [was: s/// w/o RE]

2004-04-15 Thread Randy W. Sims
On 4/16/2004 12:16 AM, Bryan Harris wrote: Wiggins> So do I after 7 years ;-)... And I after twice that. Hey, perl hasn't been around for quite 21 years! err, my math must be rusty: twice 7 years != 21 Oops, sorry, my undiagnosed dyslexia is acting up -- I read it three times, and each time it

RE: perl almost an adult? [was: s/// w/o RE]

2004-04-15 Thread Charles K. Clarkson
Bryan Harris [mailto:[EMAIL PROTECTED] : : So when was perl born? The only date I can find is 1986, : which means perl's : almost 18... DO you really think that would be in the documentation? Read 'perlhist': . . . THE RECORDS Pump-

Re: perl almost an adult? [was: s/// w/o RE]

2004-04-17 Thread Bryan Harris
> DO you really think that would be in the documentation? > > Read 'perlhist': How do you know this? I would never have thought to come up with the 8 letters - "perlhist". I just look on the Perl Bookshelf from O'Reilly, but I couldn't find any reference to the birthdate. I think that's

Re: perl almost an adult? [was: s/// w/o RE]

2004-04-17 Thread Randy W. Sims
On 4/17/2004 3:04 AM, Bryan Harris wrote: DO you really think that would be in the documentation? Read 'perlhist': How do you know this? I would never have thought to come up with the 8 letters - "perlhist". I just look on the Perl Bookshelf from O'Reilly, but I couldn't find any reference

Re: perl almost an adult? [was: s/// w/o RE]

2004-04-17 Thread John W. Krahn
Bryan Harris wrote: > > > DO you really think that would be in the documentation? > > > > Read 'perlhist': > > How do you know this? I would never have thought to come up with the 8 > letters - "perlhist". I just look on the Perl Bookshelf from O'Reilly, but > I couldn't find any reference

Re: perl almost an adult? [was: s/// w/o RE]

2004-04-17 Thread Randal L. Schwartz
> "John" == John W Krahn <[EMAIL PROTECTED]> writes: John> Furrfu, kids today. When I starting programming in Perl there was one John> man page, no books and no web sites. :-) When Larry started programming in Perl, there wasn't even a manpage. :-) print "Just another Perl hacker,"; # the

Re: perl almost an adult? [was: s/// w/o RE]

2004-04-18 Thread Jerry Rocteur
John W. Krahn wrote: Furrfu, kids today. When I starting programming in Perl there was one man page, no books and no web sites. :-) John But Tom Christiansen was there and whenever you ran a UNIX command he would tell you to do it in Perl and if you didn't know how, he'd show you even if