Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8399503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:19:22+00:00 2026-06-09T21:19:22+00:00

I wrote a Perl wrapper applying some unix commands, writing the output to a

  • 0

I wrote a Perl wrapper applying some unix commands, writing the output to a log file. However I’m seeing it create some empty file but I’m seeing some of the files being created are not 0 size, it is stating 1byte instead; therefore I’m having problem on using the “if (-s “file”) do something else do other thing” for some post processing stuff. Can somebody help why my code is creating an empty line (I guess, though I already place a chomp there), is there a way to eliminate that empty line so that the output log file will always go to 0 byte if there is no data being captured after processing the unix command? Or else.. can you suggest an effective way to check if file is not empty for case like this.

sub sub_unaccessfiles {
    my ($disk) = @_ ;
    @disk_sorted = split (/\s+/, $disk) ;
    $disk_Name = $disk_sorted[4] ;
    my $aging_disk = basename ($disk_Name) ;
    open (OUT3, ">./diskmonitor_logs/char_disks/aging_files_$aging_disk") || die "Cannot create ./diskmonitor_logs/char_disks/aging_files_$aging_disk: $!\n" ;
    my $cmd_aging_grab = `find $disk_Name -type f -name .snapshot -prune -o -atime +180 -printf '%u\t%s\t%t\t%p\n'` ;  
    chomp $cmd_aging_grab ;
    print OUT3 "$cmd_aging_grab\n" ;
    close OUT3 ;
       ..
       ..
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:19:24+00:00Added an answer on June 9, 2026 at 9:19 pm

    Try:

    print OUT3 "$cmd_aging_grab\n" if $cmd_aging_grab =~ /\S/;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote the following Perl script (below) in order to create simple XML file.
I wrote a perl script which uses some linux commands ( grep , ls
I wrote a Perl script that it makes some SQL queries in a table
I´m writing my first programs in Perl, and wrote this: use strict; use warnings;
I'm using Perl's format and write functions to output some text. The requirements are
I wrote like this Perl script.( /tmp/file is fuge) system(ssh host1 'rsync -av /tmp/file
So I wrote some perl that would parse results returned from the Amazon Web
I wrote a perl script whihc will output a list containing similar entries like
I previously wrote some utilities in Perl, and I am now rewriting them in
I wrote a perl script a while ago which logged into my online banking

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.