How to find all Keys in a hash have a value in Perl
How do you determine if all hash keys have some value ? ...
How do you determine if all hash keys have some value ? ...
What is the best way of writing the some content to the beginning and end of a File in Perl ...
I need to test Perl Application ( File operation , Data base operation..etc ) . I am looking for some profile tool for Perl code is there any tools for Perl Code Profling like gprof in Linux ...
Hi, I am a noob Perl user trying to get my work done ASAP so I can go home on time today :) Basically I need to print the next line of blank lines in a text file. The following is what I have so far. It can locate blank lines perfectly fine. Now I just have to print the next line. open (FOUT, '>>result.txt'); die "File is not a...
I'm reading the Llama (Learning Perl) book, and working on the exercises. And for this exercise: Write a program that reads a list of strings on separate lines until end-of-input and prints out the list in reverse order. [. . .] Well, I already figured out a simpler approach (I remembered you could use reverse on arrays... Perl is ...
The perldoc for fileno says Filehandles connected to memory objects via new features of open may return undefined even though they are open. Is this referring to new style calls to open in general, or to the IO::Scalar style calls to open? ...
I found a perl script that manages randomizing the wikipedia articles in Wikipedia here. The code seems to be slightly computer generated. Due to my present interest in MySQL, I thought you could possibly have the links and related data in a database. I know that MySQL is good in maintaining relations between tables, while it seems you ...
Several times I've read that unpack() is faster than substr(), especially as the number of substrings increases. However, this benchmark suggests otherwise. Is my benchmark flawed, or is the alleged performance advantage of unpack() a holdover from older versions of Perl? use strict; use warnings; use Benchmark; my ($data, $format_stri...
I am writing something that will allow users to search through a log of theirs. Currently I have this, where $in{'SEARCH'} is the string they are searching. open(COMMAND, "grep \"$in{'SEARCH'}\" /home/$palace/palace/logs/$logfile | tail -n $NumLines |"); $f = <COMMAND>; if ($f) { print $Title; print "<div id=log>\n"; ...
I'd like to run a system process, intercept the output, and modify it real-time, line by line, in a Python script. My best attempt, which waits for the process to complete before printing, is: #!/usr/bin/env python import subprocess cmd = "waitsome.py" proc = subprocess.Popen(cmd, shell=True, bufsize=256, stdout=subprocess.PIPE) for l...
I'm running into a bit of a weird error while running Perl in a chroot environment on Solaris 9 (Sparc). We are using a custom Perl, but it's almost exactly Perl 5.8.7, and this version has been running for years on various platforms including Solaris 8-10. The following code is pretty straightforward: #!/usr/bin/perl use strict; use...
I am trying to replace all £ symbols in a HTML file with £. My regular expression does not seem to work. Could you please help? ...
Replacing the Special Character using Perl while i am doing this . I got this error . I just try to merging the 2 xml file using XML::Lib. parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xA3 0x32 0x33 0x6B �23 to c�27 . What is the issue and how to resolve this this I thought before going to XML Parser , I...
I am currently creating a Perl module for in house use. I used ExtUtils::ModuleMaker to generate a build script and skeleton for my Perl module. I would like to include .ini config files that my core modules need to run properly. Where do I put these files so they are installed with my module? What path do I need to use to access these c...
I would like to color format the text printed to the console using the Perl print command. In my case the script will only be run under WinXP-DOS Command Line but it would be great if it was OS independent although I would rather tie it to WinXP than have to download a seperate package. ...
What is best module for parallel process in Perl? I have never done the parallel processing in Perl. What is good Perl module for parallel process which is going to used in DB access and mailing ? I have looked in module Parallel::ForkManager. Any idea appreciated. ...
I have a query on a PostgreSQL system returning a boolean: my $sth = $dbh->prepare("select 'f'::boolean"); $sth->execute; my @vals = $sth->fetchrow_array; According to the DBD::Pg docs, The current implementation of PostgreSQL returns 't' for true and 'f' for false. From the Perl point of view, this is a rather unfortunate ...
I'm writing an internal service that needs to touch a mod_perl2 instance for a long-running-process. The job is fired from a HTTP POST, and them mod_perl handler picks it up and does the work. It could take a long time, and is ready to be handled asynchronously, so I was hoping I could terminate the HTTP connection while it is running....
In the quest to make my data more accessible, I want to store my tabulated data in a complex hash. I am trying to grow a 'HoHoHoA' as the script loops over my data. As per the guidelines in 'perldsc': push @ { $hash{$column[$i]}{$date}{$hour} }, $data[$i]; The script compiles and runs without a problem, but doesn't not add any data to...
I have a Perl script, that's supposed to match this string: Sometimes, he says "hey fred, what's up?" It says if it found fred at the beginning, end, or middle of the word, or if it just found "fred". So it matches Alfred, and Frederich. Well, in this string, it's supposed to say it found fred on its own, but it's saying it found it a...