G
Gerhard
I've made this little script for adding two numbers from command-line:
my ($a,$b) = @ARGV;
my $prg_name = $0; $prg_name =~ s|^.*[\\/]||;
# Usage:
my $usage="Usage: \n$prg_name <A> <B>\n[]: optional Parameter\n";
if (! defined ($ARGV[0])) { print "$usage"; exit; }
print $a+$b;
C:\>add.pl 12 2
14
Content of the Text-File "input.txt":
12 2
2 4
5 7
My question is how can I "pipe" some numbers, which I've stored in a seperate
Text-File "input.txt" to the PERL Script from the DOS Command-line ?
I've tried this, but it don't work this way:
C:\>type input.txt | add.pl
my ($a,$b) = @ARGV;
my $prg_name = $0; $prg_name =~ s|^.*[\\/]||;
# Usage:
my $usage="Usage: \n$prg_name <A> <B>\n[]: optional Parameter\n";
if (! defined ($ARGV[0])) { print "$usage"; exit; }
print $a+$b;
C:\>add.pl 12 2
14
Content of the Text-File "input.txt":
12 2
2 4
5 7
My question is how can I "pipe" some numbers, which I've stored in a seperate
Text-File "input.txt" to the PERL Script from the DOS Command-line ?
I've tried this, but it don't work this way:
C:\>type input.txt | add.pl