Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: How check whether csv file with header is empty file or not in perl

by hi123 (Initiate)
on Sep 06, 2012 at 11:07 UTC ( [id://992066]=note: print w/replies, xml ) Need Help??


in reply to Re: How check whether csv file with header is empty file or not in perl
in thread How check whether csv file with header is empty file or not in perl

Hi...where should i include ur line in my script,pls advise
  • Comment on Re^2: How check whether csv file with header is empty file or not in perl

Replies are listed 'Best First'.
Re^3: How check whether csv file with header is empty file or not in perl
by CountZero (Bishop) on Sep 06, 2012 at 14:42 UTC
    Here it is:
    use Modern::Perl; open(my $data, '<', $file_c) or die "Could not open '$file_c' $!"; say 'Empty file' if 1 == scalar grep {/[^\s,]/} <$data>;

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://992066]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2024-04-25 11:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found