Mr. Shawn H. Corey wrote:
> 
> You can do this two ways: one with a multi-line regex; the other with a
> Finite-State Automation (FSA).
> 
> With regex:
> 
> # Slurp everything in a scalar, say $contents
> $contents =~ /Folder Path: '[Win_Prod_1] ag-bartend-srv\/'(.*?)Folder Path/ms;
> $lines = $1;
> @lines = split /\n/, $lines;
> 
> with FSA:
> 
> my $state = 0;
> while( <> ){
>   chomp;
>   if( /Folder Path: '[Win_Prod_1] ag-bartend-srv\/'/ ){
>     $state = 1;
>   }elsif( /Folder Path/ ){
>     $state = 0;
>   }elsif( $state == 1 ){
>     push @lines, $_;
>   }
> }
> 
> See `perldoc perlretut` and `perldoc perlre` for more information on
> regular expressions.

Hmm, a Finite State Automaton with two states? I thought that was called 'use a
flag'?

Rob

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to