Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: map, grep, for, foreach

by mt2k (Hermit)
on Jun 06, 2002 at 05:00 UTC ( #172079=note: print w/replies, xml ) Need Help??

in reply to map, grep, for, foreach

Okay I screwed that example up... Last line should say:

while (my($n,$v) = each %input) { print "$n: $v<br>"; }

It won't work the way I have it for 2 reasons: 1. I kinda threw a semi-colon in between the EXPR and the loop 2. You must show the loop first when initializing variables within the loop statement (in order to satisfy strict).

And okay, so the following code would work:

#!c:/perl/bin/perl -w use strict; use CGI 'Vars'; my %input = CGI::Vars; print "Content-type: text/html\n\n"; while (my($n,$v) = each %input) { print "$n: $v<br>"; }

Let's go to lala land and pretend could not do this. What would be the best alternative? (By the way, thanks. I have already modified my scripts to use this wonderful CGI::Vars ;))

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://172079]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2022-10-06 10:58 GMT
Find Nodes?
    Voting Booth?
    My preferred way to holiday/vacation is:

    Results (26 votes). Check out past polls.