perl -e"@_=map{glob}@ARGV;print$_,':'and$_=do{local(@ARGV,$/)=$_;<>},print$£=s!$/!!g,$/for@_" c:\*\*.pl #### #! perl -sw use strict; die "Usage: $0 filespec|glob [[filespec|glob] ... ]\n" unless @ARGV; # On Win32 CMD doesn't do globing so we need to expand @ARGV ourselves. @_ = map{glob}@ARGV; # print the name of the file and a colon print $_, ':' # Slurp the contents of the file into $_ and $_ = do{ local( @ARGV, $/ ) = $_; <>; }, # Use s///g to look for $/ (Newline for your system) in the scalar read above # by assigning s///g to a scalar it returns the number of matches # So we print that and a newline print $£ = s!$/!!g, $/ # For all the files we found by globing the command line arguments. for @_; __END__