in reply to Hex editor
If you decide to add more options later, you should look into GetOpt::Std or GetOpt::Long.#... my $Usage = "Usage: $0 {-b|-h} input.file output.file\n"; my ( $outType, $inpFile, $outFile ) = @ARGV; open (INP,"<$inpFile") || die "Can't read $inpFile: $!"; open (OUT,">$outFile") || die "Can't write $outFile: $!"; if ($outType =~ /^-h$/i) { binhex(); } elsif ($outType =~ /^-b/i) { hexbin(); } else { die $Usage; } #...
|
|---|