summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorChip Salzenberg <chip@perl.com>1997-03-21 17:42:30 +1200
committerChip Salzenberg <chip@atlantic.net>1997-03-22 15:34:25 +1200
commit8fd239a72906940af19143fd36b81affb91e8a42 (patch)
treedd8860dd669d868376287b578151f66f1cc2c55c /toke.c
parentbeb185056790fb74a315834bcd0fdb296a71c854 (diff)
downloadperl-8fd239a72906940af19143fd36b81affb91e8a42.tar.gz
If C<perl -a>, do equivalent of C<use vars '@F'>
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/toke.c b/toke.c
index f9e3b07af3..d1c60dd9a5 100644
--- a/toke.c
+++ b/toke.c
@@ -1494,16 +1494,19 @@ yylex()
sv_catpv(linestr, "LINE: while (<>) {");
if (minus_l)
sv_catpv(linestr,"chomp;");
- if (minus_a){
- if (minus_F){
- char tmpbuf1[50];
- if ( splitstr[0] == '/' ||
- splitstr[0] == '\'' ||
- splitstr[0] == '"' )
+ if (minus_a) {
+ GV* gv = gv_fetchpv("::F", TRUE, SVt_PVAV);
+ if (gv)
+ GvIMPORTED_AV_on(gv);
+ if (minus_F) {
+ char tmpbuf1[50];
+ if ( splitstr[0] == '/' ||
+ splitstr[0] == '\'' ||
+ splitstr[0] == '"' )
sprintf( tmpbuf1, "@F=split(%s);", splitstr );
- else
+ else
sprintf( tmpbuf1, "@F=split('%s');", splitstr );
- sv_catpv(linestr,tmpbuf1);
+ sv_catpv(linestr,tmpbuf1);
}
else
sv_catpv(linestr,"@F=split(' ');");