On 8/12/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > John W. Krahn wrote: > > yitzle wrote: > >> Works: > >> my $t = shift; > >> my $id = qr($t); > >> Doesn't work: > >> my $id = qr(shift); > >> > >> Why? > > > > perldoc -q "How do I expand function calls in a string" > > It's because qr is not a function, it's a quote-like operator. >
No, it's because shift *is* a function. As OP's example shows, variables interpolate, functions don't. The difference between qr($t) and qr(shift) doesn't have anything to do with qr(). It has to do with shift's behavior WRT string interpolation. It doesn't matter whether the interpolated string is being passed to an operator, a function, a subroutine, or someplace else: print "shift something my way"; print shift . " something my way"; See the FAQ John pointed you to for some ways around this. HTH -- jay -------------------------------------------------- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org values of β will give rise to dom!