In a while (<>) loop, "eof" or "eof(ARGV)" can be used to detect the end of each file (while "eof()" will only detect the end of the last file). I'd try:
my $binmode = 1; while (<>) { binmode ARGV, ":utf8" if $binmode; $binmode = eof; # Don't add parens! do_whatever($_); }
Update: Dang! The binmode comes to late to affect the first line of each file :(
In reply to Re: Using binmode on ARGV filehandle?
by ikegami
in thread Using binmode on ARGV filehandle?
by graff
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |