Perl: Opening a filehandle but not getting anything back from it
I have two perl functions defined, both run a set of shell commands on some somplied data and return hashs of the resulting parsed output from these shell commands.
One works, one doesn't and I can't seem to see why. It's driving me insane
The working one: The not-working one:
As you can see, each subroutine opens a set of filehandles, one per combination of inputs, gets them all running in the background (as they can take a few seconds to run) then parses the output from them in the order they were opened.
The non-working example above looks like it's working perfectly (I can see the shell commands executing via ps and the sulog) but nothing comes back via STDOUT when I go to read from the handle.
I've even tried adding:
to the end of the commandline and it does indeed write sensible output to the temp files that creates, but I'll be damned if I can get the same data to read off the filehandle instead.
I've also tried rewriting the subroutines to do each command one by one on a single handle, rather than use the array of handles and I get the same effect, the first one works (although more slowly), the second does not.
I've added print statements all throughout and the command looks good (if I copy-paste it into a prompt it runs just fine), but a print $_; in the while loops shows good data on the working one and nothing at all on the failing one.
I've even gone so far as to rewrite the troblesome routine from scratch to see if I just had some typo in there but the problem comes back even then.
I've bolded the filehandle open, close and commandline string creation to make it easier to read.
Any bright ideas? (And yes, I know the getcellstatus one is a bit ugly with all that $cellcount indexing but I'm afraid to touch it as it's the only one that works! )
I have gone to /usr/bin/ and click on perl but notting happens.also notting happens when i click on c/c++ or any other program
whats wrong ? (2 Replies)
Hi All,
I need some expert help in performing the following in Perl.
I have a code below but it doesn;t seem to work. Can any expert give me some advice?
Below are the requirements
1) Open numerous files assigned to an array @FILES. Note that the files are always named with the term... (7 Replies)
Hi All,
I have a total of ten file to open in the Perl script and i am using a for loop to open each file and capture some strings inside each file.
Unfortunately, i encounter the below syntax error.
I think there should be something wrong with this term reports_${counting}_${_}.txt but i do... (4 Replies)
Hi Guru's,
Pardon me for the breach of rules.....
I have very little knowledge about Shell Programming and Scripting hope you guys help me out of this troble
I have very little time hence could not find the right way to direct my queries.
coming to the problem
I need to call a... (2 Replies)
Good morning guys!!
Im still practicing with Perl and now Im trying to open a file, and copy its contents to another file. Them I want to remeove the information out of the orginal file after it is copied over.
The flow should be messages-->messages1-->messages2.
Kind of like a log... (1 Reply)
Hi,
i have run the below perl code and i am getting an error
Error:readline() on closed filehandle OR at run.pl line 31.
CODE:
===========================================
open OR,$ARGV;
while (<OR>) { # find the batch date
next if length $_ < 3; # BLANK LINE
# last if $. > 120; #... (3 Replies)
Hi
we have one function which is used to append data the file in exclusive lock mode in aperl script.
This script is executed by multiple threads at the same time.
accessing the same file.this script runs throught the day.
sometimes the file2.txt size is getting reduced.
for eg from 10 M... (1 Reply)
Hello friends,
i have a perl script as below ...
for (0 ..$#values)
{
##want to print some message here in Report.txt file
print `find /abc/xyz/pqr/$values" -type f -ls` >> Report.txt
}
I am able to get output of print `find /abc/xyz/pqr/$values" -type f -ls` >> Report.txt
in... (2 Replies)