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