shadowoflinux has asked for the wisdom of the Perl Monks concerning the following question:
#! /usr/bin/perl -w use diagnostics; use strict; use Getopt::Std; use Crypt::CBC; getopt( 'kio', \%opts ); $cipher = Crypt::CBC->new( -key => '$opts{"k"}', -cipher => 'Skipjack', ); $INFILE = %opts{"i"}; $OUTFILE = %opts{"o"}; open < INFILE or die "can't open $INFILE: $!"; open > OUTFILE or die "can't open $OUTFILE: $!"; read INFILE, $plaintext; $chipertext = $cipher->encrypt($plaintext); print OUTFILE, $chipertext; close OUTFILE; close INFILE; return (0);
Global symbol "%opts" requires explicit package name at skipjack.pl.td +y line 8. Global symbol "$cipher" requires explicit package name at skipjack.pl. +tdy line 10. Global symbol "$INFILE" requires explicit package name at skipjack.pl. +tdy line 14. Global symbol "%opts" requires explicit package name at skipjack.pl.td +y line 14.syntax error at skipjack.pl.tdy line 14, near "%opts{" Execution of skipjack.pl.tdy aborted due to compilation errors (#1) (F) You've said "use strict vars", which indicates that all variab +les must either be lexically scoped (using "my"), declared beforehand +using "our", or explicitly qualified to say which package the global var +iable is in (using "::"). Uncaught exception from user code: Global symbol "%opts" requires explicit package name at skipja +ck.pl.tdy line 8. Global symbol "$cipher" requires explicit package name at skipjack.pl. +tdy line 10. Global symbol "$INFILE" requires explicit package name at skipjack.pl. +tdy line 14. Global symbol "%opts" requires explicit package name at skipjack.pl.td +y line 14.syntax error at skipjack.pl.tdy line 14, near "%opts{" Execution of skipjack.pl.tdy aborted due to compilation errors.
UPDATE:
After following your instructions, i now have a working script. Thankyou
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Skipjack Encryption
by serf (Chaplain) on Jan 21, 2006 at 11:28 UTC | |
|
Re: Skipjack Encryption
by tirwhan (Abbot) on Jan 21, 2006 at 11:34 UTC | |
|
Re: Skipjack Encryption
by wfsp (Abbot) on Jan 21, 2006 at 11:30 UTC |