Help for this page

Select Code to Download


  1. or download this
        my @items = split $delim, $line;
    #### vs. (and I know this will make mistakes
        my @items = $line =~ /^?([^$delim]*)(?:${delim}$)?/g;
    
  2. or download this
    my @columns = ( 20, 10, 25, 5, 2, 2, 20);
    my $regex = map { "(.{$_})" } @columns;
    $regex = qr/^${regex}$/;
    
    my @items = $line =~ /$regex/;