mkj has asked for the wisdom of the Perl Monks concerning the following question:
His full example script:
my $line = '1|firstname|last, name|address1|city|state|zip'; my @stuff = split(/\|/,$line); for (@stuff) { if (/,/) { $_ = qq~"$_"~; } } my $csv = join ',' ,@stuff; print $csv;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What does $_ = qq~"$_"~ do?
by Paladin (Vicar) on May 27, 2019 at 18:27 UTC | |
by mkj (Initiate) on May 28, 2019 at 03:40 UTC | |
by Anonymous Monk on May 31, 2019 at 00:49 UTC | |
|
Re: What does $_ = qq~"$_"~ do?
by 1nickt (Canon) on May 27, 2019 at 18:36 UTC | |
by AnomalousMonk (Archbishop) on May 27, 2019 at 18:55 UTC | |
by Tux (Canon) on May 27, 2019 at 20:51 UTC | |
by mkj (Initiate) on May 28, 2019 at 03:39 UTC | |
by haukex (Archbishop) on May 28, 2019 at 07:55 UTC | |
by Fletch (Bishop) on May 28, 2019 at 14:32 UTC | |
by haukex (Archbishop) on May 28, 2019 at 20:28 UTC | |
|