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]Re: [tlug] More fun with Perl
- Date: Fri, 31 Jan 2003 15:54:01 -0500
- From: Josh Glover <jmglov@example.com>
- Subject: Re: [tlug] More fun with Perl
- References: <20030131204100.GA31015@example.com>
- User-agent: Mutt/1.4i
Quoth Josh Glover (Fri 2003-01-31 03:41:00PM -0500): > > Perl hackers, I need your help! [...] > 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. My theory was wrong. It turns out that $chunk needed to actually say "\$foo" instead of "$foo". So I had to play with $chunk: $chunk =~ s/\$/\\\$/; Now things work the way I wanted them to. And I am reminded how much I hate Perl! :-P --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: pgp00003.pgp
Description: PGP signature
- References:
- [tlug] More fun with Perl
- From: Josh Glover
Home | Main Index | Thread Index
- Prev by Date: [tlug] More fun with Perl
- Next by Date: [tlug] LPI exam preparation book
- Previous by thread: [tlug] More fun with Perl
- Next by thread: [tlug] LPI exam preparation book
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links