BernieC has asked for the wisdom of the Perl Monks concerning the following question:
and when I run it, I get:#!/usr/bin/perl use v5.10 ; use strict; use warnings ; use Text::CSV ; use FileHandle ; my $csv = Text::CSV->new((binary => 1)) ; my $fh = new FileHandle ; open($fh, "<", $ARGV[0]) or die "Can't open $ARGV[0]: $!\n" ; say $fh ; my $row = $csv->getline($fh) ; exit
I printed out $fh and it was clearly not undefined. The file is a vanilla windows-format file and neither my text editor nor excel nor word have a problem with it. ??? My little test file was pretty trivial:Desktop>csvtest.pl testcsv.csv FileHandle=GLOB(0x1e9c20) Can't call method "getline" on an undefined value at D:\Desktop\csvtes +t.pl line 16.
Importance,Company,Department,"Job Title"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: TexT::CSV and getline
by GrandFather (Saint) on Nov 04, 2020 at 20:16 UTC | |
by BernieC (Pilgrim) on Nov 05, 2020 at 15:22 UTC | |
|
Re: TexT::CSV and getline
by swl (Prior) on Nov 04, 2020 at 21:03 UTC | |
|
Re: TexT::CSV and getline
by BillKSmith (Monsignor) on Nov 04, 2020 at 21:43 UTC | |
|
Re: TexT::CSV and getline
by jszinger (Scribe) on Nov 04, 2020 at 20:02 UTC | |
|
Re: Text::CSV and getline
by davies (Monsignor) on Nov 04, 2020 at 20:07 UTC |