fork download
  1. #!/usr/bin/perl
  2.  
  3. use Data::Dumper;
  4.  
  5. my $foo = 'one#two#three!four#five#six';
  6. my @parts = split /#|(?=!)|(?<=!)/, $foo;
  7. print Data::Dumper->Dump(\@parts);
Success #stdin #stdout 0s 21264KB
stdin
Standard input is empty
stdout
$VAR1 = 'one';
$VAR2 = 'two';
$VAR3 = 'three';
$VAR4 = '!';
$VAR5 = 'four';
$VAR6 = 'five';
$VAR7 = 'six';