Home : General : Perl Programming :

General: Perl Programming: Re: [Chaz] declaring variable: Edit Log

Here is the list of edits for this post
Re: [Chaz] declaring variable
Code:
#!/usr/bin/perl
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
#use strict;
use CGI;my $q = CGI->new;

my %in = $q->Vars;
print $q->header;
foreach my $key (keys %in) {
print "$key => $in{$key}<br>\n";
$$key = $in{$key};
}
print $me . "<br>\n";
print $clock . "<br>\n";


This does what I want, but it only works when I turn off use strick...

Example if I call test.pl?me=yeah&clock=cooking... it will print that...

or I could add "&comp=dell" and $comp would automatically equal "dell".

See what I'm saying... I just makes things easier rather than calling it from $in{'comp'} or $q->param{comp} or whatever.

So since the above function works with use strict off, how can I get it more precise to work with use strict on?

I already tried

my $$key = $in{$key};

any ideas?

- Jonathan

Last edited by:

jdgamble: Sep 3, 2004, 4:11 PM

Edit Log: