#!/usr/bin/perl use strict; #open DATA, ") { if(m/END/) { print "END line is on line >$.\n"; print "END line is >$_\n"; my $pos = $.; $pos--; chomp $pos; $DESIRED_LINE_NUMBER = $pos; } } print "Moving to line number $DESIRED_LINE_NUMBER\n"; $. = 0; do { $LINE = ; print "Discarding: $LINE\n" } until $. == $DESIRED_LINE_NUMBER || eof; print "Found desired line $DESIRED_LINE_NUMBER as '$LINE'\n"; __DATA__ foo bar baz END bloob blargh blubb blubb2 #### C:\Projekte>perl -w tmp.pl >4 >END Moving to line number 3 Use of uninitialized value $LINE in concatenation (.) or string at tmp.pl line 2 6. Discarding: Use of uninitialized value $LINE in concatenation (.) or string at tmp.pl line 2 7. Found desired line 3 as ''