in reply to Re^2: regex behaves differently in split vs substitute?
in thread regex behaves differently in split vs substitute?
Eeeeeeewwwwww :P
#!/usr/bin/perl -- use strict; use warnings; my $dita = <<'__DITA__'; mono-basic-2.10 mono-2.10.2-r1 mono-2.10.5 __DITA__ open my $data => '<', \$dita or die $!; while( my $line = <$data> ){ if( my ($version) = $line =~ /^[a-z-]+(\d.*)\s*$/ ){ print ">>$version<<\n" } } __END__ >>2.10<< >>2.10.2-r1<< >>2.10.5<<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: regex behaves differently in split vs substitute?
by Marshall (Canon) on Oct 08, 2011 at 13:54 UTC | |
by Anonymous Monk on Oct 08, 2011 at 13:58 UTC | |
by AnomalousMonk (Archbishop) on Oct 08, 2011 at 18:43 UTC |