in reply to Re^7: Offset Reading - two files
in thread Offset Reading - two files

I will try to work this out, the difference I see is that my input BIG file is a 'single' record, there are no record separator in it, each 'record' is identified by offset and length from the index file, somewhat different from what you illustrated. Is the seek command behaving differently in my case? I even tried:

perl -sple 'BEGIN{open BIG};($1,$2)=split;read(BIG,$_,$2,$1)' -- -BIG=$2 index.dat > output.dat

with the same error . Thanks

Replies are listed 'Best First'.
Re^9: Offset Reading - two files
by BrowserUk (Patriarch) on Dec 14, 2012 at 16:47 UTC

    You are still trying to use the readonly variables $1 & $2, hence the error message.

    I suggest that you learn simple Perl, before you try to do complicated things with it. If you do not have enough time to learn, employ someone to do it for you.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    RIP Neil Armstrong

      Thanks so much. I got this to work. <p>perl -sple 'BEGIN{open BIG};($offse,$recl)=split;seek(BIG,$offse,0);read(BIG,$_,$recl)' -- -BIG=datain index.dat >out </p> Thanks for the support. I promise I will put more time in learning the basics before bothering you again. Bye