Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: What is causing sha1 system call to fail to redirect?

by toolic (Bishop)
on Jul 15, 2015 at 20:29 UTC ( [id://1134955]=note: print w/replies, xml ) Need Help??


in reply to What is causing sha1 system call to fail to redirect?

You need to elaborate on "fail to redirect" and "my code is failing". Do you not get an output file? Is the output file empty?
@files = <STDIN>;
You don't show how you are running your code, but that line might be causing your code to appear to hang until you enter Ctrl-C, or some such. Also, you keep clobbering your output "data" file for each input file. Maybe you want something more like:
use warnings; use strict; for my $file (@ARGV) { print "Preforming sha1 on $file\n"; system( "sha1sum $file >> data" ); }

Run it like:

code.pl file1 file2 file3

Replies are listed 'Best First'.
Re^2: What is causing sha1 system call to fail to redirect?
by Puregnome45 (Initiate) on Jul 15, 2015 at 21:05 UTC

    Fair point, and thanks for remaining me. I meant to mention this in the actual post, but it is showing the output in the console; that is the file is completely empty.

    I'll give it like 10 or 15 files to encrypt and it prints sha1's output to the console and still creates the file 'data,' just empty.

    I'm not at work to actually test that fix, but I will be sure to first thing in the morning. I'd do it here at home, but I don't have Perl installed, and I'm only going to be working with Perl for another few weeks.

    Thanks for the speedy response!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found