in reply to Re: Filehandle opened only for output error
in thread Filehandle opened only for output error

Oh,sorry to bother again, but I did what u said, and it doesnt show anything although I have gave it parameters('mon.txt') after finishing the subroutine,but it doesnt show me anything(I have checked that it does have something).Any suggestions?

  • Comment on Re^2: Filehandle opened only for output error

Replies are listed 'Best First'.
Re^3: Filehandle opened only for output error
by ikegami (Patriarch) on Aug 21, 2009 at 17:16 UTC
    According to what you showed us, you never print out anything. You don't even call the function to read the file!
Re^3: Filehandle opened only for output error
by baxy77bax (Deacon) on Aug 21, 2009 at 17:07 UTC
    well then probably something else is wrong. could you show us a wider context in which this function is used. here is an example that refers to your 'problem' but with a working procedure.
    use strict; use Data::Dumper; open(FILE, "<", "file.in") || die "Error in : $!"; my @array = <FILE>; close FILE; print Dumper(\@array); file.in here i am , where are you, i am here and you also here
    cheers

    PS

    try dumping the @lineas to check if the data is in the array. if it is then surely the problem is somewhere else.

    use Data::Dumper; sub Take_Txt{ my $archivo = shift; open my $ARCHIVO, '>', $archivo or die $!; my @lineas = <$ARCHIVO>; close $ARCHIVO; shift(@lineas); die Dumper(\@lineas); return @lineas; }