my $fname = "while_multi_cond.dat"; my $s1 = ""; open( FP, "<", $fname ) or die "Can't open $fname: $!"; while() { if (/^_start/) { # This works as expected # while( ) { # if (/^_stop/) { last } # I'm trying to replace it with this: while( () && (!/^_stop\n/) ) { # but seems to break the functionality of $_ $s1 .= $_; } } if ($_) { print("$_") } } print("\$s1= \n<$s1>"); #### The file: while_multi_cond.dat ----- no1 no2 _start yes 1 yes 2 _stop no3 no4 ---------- #### ~> ./while_multi_cond.pl parse_data> ./while_multi_cond.pl no1 no2 _start $s1= <_start _start _start _start _start _start >