in reply to splitting pipe into new line
It's not clear to me what you want. If you want to replace all pipes with a newline, you can use s///:
use warnings; use strict; my $description = 'a|b|c|d|e'; $description =~ s/\|/\n/g; print "$description\n"; __END__ a b c d e
Or, if you really want an array, you can add newlines using map
my $description = 'a|b|c|d|e'; print "$description\n"; my (@new) = map {"$_\n"} split (/\|/, $description); print @new;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: splitting pipe into new line
by PerlSufi (Friar) on Jun 14, 2013 at 17:27 UTC |
In Section
Seekers of Perl Wisdom