Help for this page

Select Code to Download


  1. or download this
    $text = 'a|b|c|||||||||e||||';
    @array = split(/\|/,$text);
    print join '-', @array;
    
  2. or download this
    $text = 'a|b|c|||||||||e||||';  # our input might have holes in it!
    $text =~ s#\|\|#\|NULL\|#g;  # make holes read as 'NULL'
    @array = map { $_ eq 'NULL' ? undef : $_ } split(/\|/,$text);  
    print join '-', @array;