perl -MTie::Scalar -M"5;{package SN; use parent -norequire => 'Tie::StdScalar';sub FETCH {print qq(Opening ${$_[0]}); ${$_[0]}}}; tie $ARGV, SN" -nlE "say qq(\tprocessed $ARGV) if eof" 001.txt 002.txt 003.txt Opening 001.txt Opening 002.txt Opening 002.txt processed 002.txt Opening 003.txt