[Solved] What is an alternative for split in Perl? [closed]


Howzabout this:

#!/usr/bin/perl
use warnings;
use strict;
my $s = 
q/a: b
d: e
f: a:b:c
g: a
   b
   c
   d
   f:g:h
h: d
   d:dd:d
   f
/;
open my $input, "<", \$s or die $!;
my @left;
my @right;
while (<$input>) {
    chomp;
    my ($left, $right) = /^(.):?\s+(.*)$/;
    push @left, $left;
    push @right, $right;
}
print "left:", join ", ", @left;
print "\n";
print "right:", join ", ", @right;
print "\n";

2

solved What is an alternative for split in Perl? [closed]