That is command line shell syntax. It should work on unix if you enclose it in backticks `.....`.
Here is the equivalent in perl (using perl's grep or a loop):
#!/usr/bin/perl -w use strict; my $file = 'c:/test.pl'; my @file = get_file($file); my @results = grep { /my/ } @file; # the grep is equivalnet to this code # foreach $line (@file) { # push @results, $line if $line =~ m/my/; # } set_file( 'c:/results.txt', @results ); exit; sub set_file { my $file = shift; open FILE, ">$file" or die "Oops can't write $file $!\n"; print FILE @_; close FILE; } sub get_file { my $file = shift; open FILE, $file or "Oops can't read $file: $!\n"; my @content = <FILE>; close FILE; return @content; }
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Getting a grip on codegrep/code
by tachyon
in thread Getting a grip on grep
by jerrygarciuh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |