Perl Mania

Would you like to react to this message? Create an account in a few clicks or log in to continue.

Perl - Practical Extraction and Report Language. Ask questions and Suggest Answers about perl programming, syntax, variables, scoping, constructs, operators and functions, files, I/O, regular expressions, regex, subroutines, perl mod


2 posters

    Perl file handling

    avatar
    Anitha
    Newbie
    Newbie


    Posts : 6
    Join date : 2008-12-02

    Perl file handling Empty Perl file handling

    Post  Anitha Thu Dec 11, 2008 6:20 am

    Hi,

    I have a requirement like this:
    I have a file with some content.
    and i need to fetch only 19 bytes of data.
    How can i achieve this?
    Raj
    Raj
    Admin
    Admin


    Posts : 3
    Join date : 2008-11-26
    Age : 40
    Location : Bangalore

    Perl file handling Empty Re: Perl file handling

    Post  Raj Thu Dec 11, 2008 7:14 am

    Anitha wrote:Hi,

    I have a requirement like this:
    I have a file with some content.
    and i need to fetch only 19 bytes of data.
    How can i achieve this?

    open(FH,"<out.txt") || die "can't open file";

    read(FH, $lbyte, 19)|| die "can't read from file";

    close FH;

    print "$lbyte";


    Enjoy,
    Raj
    avatar
    Anitha
    Newbie
    Newbie


    Posts : 6
    Join date : 2008-12-02

    Perl file handling Empty Re: Perl file handling

    Post  Anitha Thu Dec 11, 2008 7:39 am

    Thanks Raj.
    I have done the same previously

    Sponsored content


    Perl file handling Empty Re: Perl file handling

    Post  Sponsored content


      Current date/time is Sun May 19, 2024 9:32 am