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

    Use of perl getc function

    avatar
    Anitha
    Newbie
    Newbie


    Posts : 6
    Join date : 2008-12-02

    Use of perl getc function Empty Use of perl getc function

    Post  Anitha Fri Dec 12, 2008 1:48 am

    open(FILEHANDLE,"<Anita2.txt") or die "Error in opening file";
    my $string=getc FILEHANDLE;
    print $string;
    close(FILEHANDLE) or die "Error in closing filehandle:$!";

    Here iam trying to retrieve the very first character in the filehandle.
    but its throwing the error:Use of uninitialized value in print
    Raj
    Raj
    Admin
    Admin


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

    Use of perl getc function Empty Re: Use of perl getc function

    Post  Raj Fri Dec 12, 2008 1:56 am

    Anitha wrote:open(FILEHANDLE,"<Anita2.txt") or die "Error in opening file";
    my $string=getc FILEHANDLE;
    print $string;
    close(FILEHANDLE) or die "Error in closing filehandle:$!";

    Here iam trying to retrieve the very first character in the filehandle.
    but its throwing the error:Use of uninitialized value in print

    Every thing looks fine to me. only possibility is the file (Anita2.txt) is empty. Very Happy

    Enjoy,
    Raj
    avatar
    Anitha
    Newbie
    Newbie


    Posts : 6
    Join date : 2008-12-02

    Use of perl getc function Empty Re: Use of perl getc function

    Post  Anitha Fri Dec 12, 2008 2:04 am

    Its not Empty. I has content.
    avatar
    Anitha
    Newbie
    Newbie


    Posts : 6
    Join date : 2008-12-02

    Use of perl getc function Empty Re: Use of perl getc function

    Post  Anitha Fri Dec 12, 2008 2:21 am

    Somehow the content in the file has lost sorry Smile

    Sponsored content


    Use of perl getc function Empty Re: Use of perl getc function

    Post  Sponsored content

      Similar topics

      -

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