develooper Front page | perl.perl5.porters | Postings from May 2004

Re: [perl #29675] -i vs. BEGIN and END (docpatch)

From:
Rafael Garcia-Suarez
Date:
May 21, 2004 03:54
Subject:
Re: [perl #29675] -i vs. BEGIN and END (docpatch)
Message ID:
20040521125144.0bed60d6@localhost
david nicol wrote:
> 
> --- perl-current/pod/perlrun.pod	Tue May 18 08:28:56 2004
> +++ perl-current-new/pod/perlrun.pod	Fri May 21 03:06:23 2004
> @@ -531,10 +531,14 @@
>  Perl does not expand C<~> in filenames, which is good, since some
>  folks use it for their backup files:
>  
>      $ perl -pi~ -e 's/foo/bar/' file1 file2 file3...
>  
> +Code within C<BEGIN> and C<END> blocks, being outside of the
> +implicit program loop created by the B<-i> switch, does not have
> +its I/O redirected. 

In fact, -i doesn't create any program loop. It's -p that does.
-i only modifies the behaviour of <>, which is implicitely
read by -p.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About