Thanks for looking!#!/usr/bin/perl use strict; use warnings; use Data::Dumper qw(Dumper); # Test cases: my $string_a = "Joe Dolly"; # It should split and print JD. my $string_b = "perl.pl"; # It should match on the regular expressio +n and nothing prints. my $string_c = "States"; # It should match on the regular expressio +n and nothing prints. my @got = $search_c =~ /^(?!\w)|(\.[^.]+)$/ig ? [] : split //, $string +_c; print Dumper $got[0]; print Dumper $got[1];
In reply to Split string only on regular expression match by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |