use warnings; use strict; my $str = "lhs|rhs"; print "\n" . join " ", split '\|', $str; print "\n" . join " ", split /\|/, $str;