Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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 ( [id://992109]=note: print w/replies, xml ) Need Help??


in reply to Re^2: 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

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
  • Comment on Re^3: How check whether csv file with header is empty file or not in perl
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2024-04-23 17:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found