Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
thanks all advice appreciated.#! /usr/local/bin/perl -w use strict; my $num_of_params; $num_of_params = @ARGV; if ($num_of_params < 3) { die ("\n Not enough parameters have been entered!!!!\n"); } open (INPUT, $ARGV[0]) or die "unable to open file, perl says $!"; open (OUTFILE, ">$ARGV[1]"); my $count = 1; my $line; my $limit = $ARGV[2]; while (<>) { chomp; $line = $_; $line =~ s/(.{60})/$1\n/g; if (/>/) { ++$count; } print "\>$count\n", $line , "\n\n" if length $_ >= $limi t; print OUTFILE "\>$count\n", $line, "\n\n" if length $_ > = $limit; } close INPUT; close OUTFILE;
Edit kudra, 2002-05-17 Put in &#091; and ] to replace literals in arrays out of code context
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: specifying numeric values for scalar variables with $ARGV
by Biker (Priest) on May 17, 2002 at 10:15 UTC | |
|
Re: specifying numeric values for scalar variables with $ARGV
by Dog and Pony (Priest) on May 17, 2002 at 12:15 UTC | |
|
Re: specifying numeric values for scalar variables with $ARGV
by rinceWind (Monsignor) on May 17, 2002 at 09:49 UTC |