11.44. Solution: Split CGI

Example 11-16. examples/regex/split_cgi.pl

#!/usr/bin/perl
use strict;
use warnings;
 
my $str = 'fname=Foo&lname=Bar&email=foo@bar.com';
my %data = split /[=&]/, $str;

use Data::Dumper;
print Dumper \%data;

If you are interested in on-site trainings by the author, please contact me directly.

Online courses:

Would you like to get
updated when I publish
the next article?

Follow me:

Google Plus Twitter RSS feed