Sorry that I am not good in English , so dunno what do you want exactly =)
But after in view of your code, it seem that you 've doing something wrong,
maybe... I don't know...... So let's check it out  =)


>
> ---Code Snip----
>
> open (IN, "tst.txt) or die "Cannot open $file for read :$!";
>
> my $linenum;
>
> open (INCFG, "cfg.txt") or die "Cannot open $file for read :$!";
>
> #Get Line number from cfg.txt
>
> while (<INCFG>){  $linenum = $_ }

How many lines inside cfg.txt ? If you have more than one line,
$linenum will finally equal to the last line's "content".

If just one line and you want to grab it, just
$linenum = <INCFG> ; # Beware to 'chomp' it if CR at the end.

If you want to know the total line of this file,
you may write as  :
my $totalLn = 0; $totalLn ++ while (<INCFG>);

> close INCFG;

For more readable, you can try to make the 'segment' from
open (INCFG.....) to close (INCFG) , this segment above the
open (IN....), because you didn't do anything refer to IN
within your opening and closing of INCFG.

>
> seek(IN,$linenum,0);
> while (<IN>){     #do some processing    }
> close IN;

I don't know what is inside tst.txt , however, if you think
seek can help you to go to the line where your $linenum
stated, you are wrong.

I will use the word byte, for seek's activity... suppose here is a file's
content

ABCDEFGHIJ
KLMNOPQRST

seek (THISFILE, 5, 0);
read (THISFILE, $char, 1);
you got $char = 'F'

if you change the read (...) to $line = <THISFILE>;
you got $line = "FGHIJ".

Rgds,
Connie


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to