in reply to Comandline arguements when perl code is getting executed from command line

First, you have a useless use of cat.

Second, why are you doing shell at all? Why not do this all in Perl?

open my $f, "<", "file" or die; while (<$f>) { chomp; my ($file_name, $type) = split /\|/; open my $inner, "<", $file_name or die; while (<$inner>) { if (/TABLE/) { print "$file_name:$type\n"; # last ? } } }
  • Comment on Re: Comandline arguements when perl code is getting executed from command line
  • Download Code

Replies are listed 'Best First'.
Re^2: Comandline arguements when perl code is getting executed from command line
by jesuashok (Curate) on Jan 16, 2007 at 03:28 UTC
    hi merlyn,

    thanks for giving me( all monks too ) a nice note on "useless use of cat". My shell script does lot of other task also. I have just copied a required part and asked in perlmonks. Just I am curious to know how that can be done ? that is all. Doing everything in perl is not a bad idea at all.

    thanks a lot merlyn.