Re: What does "}{" mean?

"Daniel R. Allen" <[email protected]>
Newsgroups gmane.comp.lang.perl.fun
Message-ID <[email protected]>
I am appalled that that works.  I thought perlrun was being figurative
when it described -p, but it seems not so.

  daniel@D:~/work$ perl -MO=Deparse -pe ' } { $_="foo\n"' /dev/null
  LINE: while (defined($_ = <ARGV>)) {
      ();
  }
  {
      $_ = "foo\n";
  }
  continue {
      print $_;
  }
  -e syntax OK


  daniel@D:~/work$ perl -MO=Deparse -pe '$_="foo\n"' /dev/null
  LINE: while (defined($_ = <ARGV>)) {
      $_ = "foo\n";
  }
  continue {
      print $_;
  }
  -e syntax OK



On Fri, 6 Feb 2004 [email protected] wrote:

>
>
> What does the construct "}{" mean?  As in
>
>
>   $ perl -pe ' } { $_="foo\n"' /dev/null
>   foo
>
> I figure it has to do with how the -p switch affects the script that
> is passed to the interpreter.  Is this documented anywhere?
>
> kj
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.