Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][tlug] More fun with Perl
- Date: Fri, 31 Jan 2003 15:41:00 -0500
- From: Josh Glover <jmglov@example.com>
- Subject: [tlug] More fun with Perl
- User-agent: Mutt/1.4i
Perl hackers, I need your help! Dig this code fragment (i.e. line of code): $str =~ s/\[?$chunk\]?/$value/; Now, allow me to paste a bit of a debug session: DB<6> p $str What is foo? $foo DB<7> p $chunk $foo DB<8> p $str =~ /\$foo/ 1 DB<9> p $chunk eq "\$foo" 1 DB<10> p $str =~ /$chunk/ My question is this: when $chunk == "\$foo" and $str =~ /\$foo/ is true, why is $str =~ /$chunk/ not true? My theory is that Perl is interpreting /$chunk/ as end-of-line, followed by literal "chunk". This is certainly not what I want. And Perl is behaving the way that I expect (i.e. evaluating $chunk first and trying to match its value literally) in other places in my code. Any ideas here? I certainly have read through the perlre documentation, and saw no clues therein. TIA, Josh -- Josh Glover <jmglov@example.com> Associate Systems Administrator INCOGEN, Inc. http://www.incogen.com/ GPG keyID 0x62386967 (7479 1A7A 46E6 041D 67AE 2546 A867 DBB1 6238 6967) gpg --keyserver pgp.mit.edu --recv-keys 62386967Attachment: pgp00002.pgp
Description: PGP signature
- Follow-Ups:
- Re: [tlug] More fun with Perl
- From: Josh Glover
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] GREP basics
- Next by Date: Re: [tlug] More fun with Perl
- Previous by thread: Re: [tlug] GREP basics
- Next by thread: Re: [tlug] More fun with Perl
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links