SPUG: range operator
Florentin
florentin_ at hotmail.com
Fri Mar 30 00:21:40 PDT 2007
Indeed I mixed returned boolean with <$.> but original explanation from
Jacinta, pointed that adding one to false is true. David Dyck solution
is elegant - originally I sliced @section like @section[1..(@section-1)].
while ( defined( ( my $x = <ARGV> ) ) ) {
if ( my $t = ( ( $x =~ /$start/ ) .. ( $x =~ /$end/ ) ) ) {
chomp $x;
if ( $t > 1 and $t !~ /E0$/ ) {
push @section, $x;
}
}
if ( $x =~ m/$end/ ) {
parseSection(@section);
@section = ();
}
}
Michael R. Wolf wrote:
> Having understood what the range operator (I like to call it a flip-flop in
> these situations) does, is your question-behind-the-question answered?
>
> That is, did you get done what you need to do?
>
> It looks like you're trying to mix the match operator (on $_) with the
> flip-scalar flip-flop behavior (on $. (aka $INPUT_LINE_NUMBER)). If that's
> what you need, it seems like your need is still unmet.
>
>
>
More information about the spug-list
mailing list