in reply to Perl Module to parse text file

Sure, here it is

package Gary::Yang; sub parse { my( $in ) = @_; my @junk; while(my $line = <$in> ){ push @junk, [ split ':', $line, 2 ]; } return @junk; }

Replies are listed 'Best First'.
Re^2: Perl Module to parse text file
by Anonymous Monk on Apr 10, 2012 at 07:57 UTC
    package Doodle; use Modern::Perl; sub bop { my( $in ) = @_; my @dark; my @records; while( <$in> ){ next if /<[^>]+>/; if( /^\s*$/ ){ push @records, [ @dark ] if @dark; undef @dark; } else { s/\s+$//; push @dark, [ split ':', $_, 2 ]; } } return @records; }