in reply to Re: $^I why this symbol does not work ?
in thread $^I why this symbol does not work ?

my $new_par = "YI_OU"; open MYFILE,"c:/perl/test/1.txt" or die "cannot open file:$!"; local $^I = ''; local @ARGV = MYFILE; while(<>){ s/UI_EM/$new_par/g; print; }
run it .an error occur:
Bareword "MYFILE" not allowed while "strict subs" in use at C:\Perl\study\test.pl line 9.
By the way could you tell me what is "magic ARGV file handle"?
I am new perler.thanks.

Replies are listed 'Best First'.
Re^3: $^I why this symbol does not work ?
by ikegami (Patriarch) on Oct 01, 2008 at 06:36 UTC

    Put file names (not handles) in @ARGV:

    my $new_par = "YI_OU"; local $^I = ''; local @ARGV = 'c:/perl/test/1.txt'; while(<>) { s/UI_EM/$newpar/g; print; }
Re^3: $^I why this symbol does not work ?
by moritz (Cardinal) on Oct 01, 2008 at 06:43 UTC
    local @ARGV = MYFILE;

    That's not the code I gave you.

    By the way could you tell me what is "magic ARGV file handle"?

    It's all in the docs.