Because my eyes got too distracted I copied and pasted your buggy and fixed versions of the second sub and made a diff
I should have thought of that - good idea!
Quote:
Originally Posted by buffoonix
I think the removal of return on a failed open didn't make the difference
(though I would assume it to be better style after all if you couldn't reconcile with a die on that condition).
Tried adding || return back in, still works (so I've kept it in).
Quote:
Originally Posted by buffoonix
However, what I think made the difference was the explicit lexical redeclaration of $sysmanhandle.
Tried adding and removing the 'my' flag and it made no difference (so I've left it in).
Quote:
Originally Posted by buffoonix
I'm assuming this is just a false hit caused by a different line number.
So that leaves me still wondering what I did wrong the first time but not the second... It feels like an unprintable character or something but I've pulled out the old broken version and stupidly deleted it so I can't go and find out.
Quote:
Originally Posted by buffoonix
I also would have advised to set the autoflush before the reading loop by squeezing in a
hadn't you come up with the solution.
Tha's a good point, I've not been paying much attention to my buffers. I might go back through the whole thing and make a concious decision in each case. The close should clear most things but best to be safe
Quote:
Originally Posted by buffoonix
Sorry, for ill-advising you on presumed redundancy of quotes.
Even if I were right it is always better to be explicit.
I just was thinking about a talk I once attended at a Perl conference or workshop held by
Mark Jason Dominus (author of Higher Order Perl)
where he ranted about cave men dwellers' useless quoting voodoo.
I see some loopy quoting myself and have been a culpret too from time to time
Quote:
Originally Posted by buffoonix
He there brought onto my radar the wonderful Deparse module
to check what Perl really makes out of your expressions.
Have a look at
in case you haven't come about it yet.
Will do so, that sounds really useful for optimising some of my more complex strings.
Quote:
Originally Posted by buffoonix
The lexical vars as valid file handles to an open call became available as of Perl 5.6.0
if I remember correctly.
If your Perl is that old or even older then you should really consider an update
5.005_03 - like I said, pretty old I could potentially upgrade but I'm trying to make this thing work on an existing production system without having to install much else.
I'll avoid going to a sensible version of perl as long as I can.
That's really legacy stuff but you can be glad it's not even 5.004.
However, I can see your constraints.
I also have many systems where I am not supposed to install anything
even if it was for the better.
I've just come back from YAPC::EU 2008 where I got many inspirations,
foremost of course to move to Perl 5.10 which unanimously was considered the best Perl ever and as Damian put it, already feels like 10% of Perl 6.
Until we get Perl 6 which should be out by Xmas - we can't yet tell which Xmas.
But then every day will be like Xmas.
Quote:
I got the idea from my own insane musings then found an example on PerlMonks - The Monastery Gates
I think that's the best you can do because at Perl Monks you will find many of the world's best Perl hackers.
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)
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)
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)
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 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)
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 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)
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)