I am trying to append two files in a single file using command line arguments but I am getting many errors like Global symbol "$usage" requires explicit package name at add.pl line 14. Global symbol "$usage" requires explicit package name at add.pl line 26. Global symbol "$result" requires explicit package name at add.pl line 32.
#!/usr/bin/perl use strict; use warnings; use File::Basename; $| = 1; my $scriptname = fileparse(__FILE__); my $t; my $imgfile; my $hash_filename; my $Signed_filename my $usage = " Usage: $scriptname (-i <file1> -t <file2> -o <Output_file> ) ** Image Types ** -i <file1> : Required: -t <file2> : Required.Inout file to read the unsigned file -o <Output_file> : Required. Output file to write the sig +ned input file "; if ($#ARGV == -1) # if user enters no arguments, exit with the usage i +nstructions { die $usage; } # Get the command line options passed to us $result = GetOptions ("File1=s" => \$file1, "File2=s" => \$file2, "out=s" => \$Output_file); open(FH,">$Output_file") or die "$!\n"; print FH $file1,"\n" ; print FH $file2,"\n" ; close FH;
What am I doing wrong?
In reply to Appending two files by abcdefg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |