#!usr/bin/perl use warnings; use strict; sub contents { local @ARGV = @_; return my @t = <>; } my $text; $text = contents 'contents2'; print $text . "\n"; my @text = grep /important/, contents 'contents2'; print @text, "\n"; print @ARGV, "\n";