English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

how do i open a file into a program that i have written to print out the exemptions of that file that i have typed in the command line eg.

home$ testprg.pl colour.txt

how do i get my program "testprg.pl" to open that colour.txt file formt he command line.... help

2006-08-29 13:03:21 · 1 answers · asked by prettybee 2 in Computers & Internet Programming & Design

1 answers

If the Perl program is expecting to read standard input, what you wanted is:

home$ testprg.pl < colour.txt

The < is a "redirect" operator.

If you want the program to open it itself, you'll need to code that in your Perl program:

my $fn ,$FILE;
$fn= $ARGV[1];
$file = open($fn) || die "can't open input file";
while() {
# do something
}

You get the idea.

2006-08-29 13:26:28 · answer #1 · answered by Valdis K 6 · 0 0

fedest.com, questions and answers