#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use Data::Dumper;
my $cgi = CGI->new();
my %p = $cgi->Vars;
# if you don't like the \0 delimiter, replace it by your own one; e.g.:
s/\0/[whatever I want]/g for values %p;
print Dumper \%p;
__END__
$ perl T.pl a=1 b=1 b=2 b=3
$VAR1 = {
'a' => '1',
'b' => '1[whatever I want]2[whatever I want]3'
};
####
#!/usr/bin/perl -l
use strict;
use warnings;
my $text = qq(I
have
multiple
lines
);
print $text =~ s/\n/\n/g; # substitute
print $text =~ tr/\n//; # transliterate
__END__
##
##
#!/usr/bin/perl
use strict;
use warnings;
use Text::CSV;
my $csv_file = 'test.csv';
# binary => 1 : makes Text::CSV work on multi-lined fields
my $csv = Text::CSV->new( { binary => 1 } );
#open my $fh, '<', $csv_file or die "$csv_file: $!\n";
# *DATA; instead of opening a separate file; using the data section at the end of file
my $fh = *DATA;
# read rows and store them in an array reference
while ( my $ref = $csv->getline( $fh ) ) {
# dereference the reference and simply print the elements
print "@$ref\n";
}
#close $fh or die "$csv_file: close failed: $!\n";
__DATA__
"column1","column2","column3"
"single1","single2","single3"
"single4","multiA
multiB",single5