in reply to Remove & from file

Well, just in terms of cosmetics, let me suggest that you place the subroutine definition outside the foreach loop -- it just makes more sense that way, and is less confusing.

As for the procedure, you say the input file contains (one or more?) line(s?) like "&name1=value1&name2=value2&...", and if that is true, can you say what this line of coding is doing, and why you're doing this:

($info) = split(/\ /,$i);
I'm not sure (anything containing strings of two or more white-space characters is visually ambiguous), but I think:

As for your stated purpose (to "remove &"), that's not entirely clear either. If you just remove this character from the input, you'll get (one or more?) strings like "name1=value1name2=value2name3=value3...", and I don't think that's what you want.

Maybe you mean "how do I split the line at the "&" characters?" If so, you do it like this:

my %parhash; for my $i (@data) { chomp $i; my @params = split( /\&/, $i ); # and while you're at it, the "nameX=valueX" can be # stored in a hash like this: for ( @params ) { next unless ( /.=./ ); # make sure there's a name and a value my ($k,$v) = split(/=/); $parhash{$k} = $v; } } # print html header stuff, then: print "user supplied data was:<br>\n"; for ( sort keys %parhash ) { print "$_ = $parhash{$_}<br>\n"; } # print html trailer stuff