I am writing a program to extract data from a bunch of text files and stuff it into DB. All of my commands currently have the form similar to this (with different queries):
$query = "INSERT INTO relations (relation_type_id, confidence) VALUES ($reltypeid, $conf)";
print "$query\n";
$result = $conn->query($query);
$relid = $result->inser...
Hi there,
I'm writing some Perl which takes TV shows recorded on Windows Media Center and moves/renames/deletes them depending on certain criteria.
Since the Perl runs fairly frequently, I'd like to cleanly determine whether or not the file is in use (in other words, the show is in the process of being recorded) so I can avoid doing an...
I'm new to using Perl to call the linux command line and have looked through a number of tutorials but still can't figure out what I am doing wrong.. I am trying the code below (in a .pl perl file, as an executable):
#!/usr/bin/perl
perl -e 'print "Hello";'
I run this script and get: "Execution of /home/user1/Desktop/file_backups.pl...
Hi;
I need to convert the following perl function to php:
pack("SSA12AC4L",
$id,
$loc,
$name,
'ar',
split(/\./, $get->getIP),
time+(60*60);
I use the following code (to test) in PHP:
echo pack("SSA12AC4L",
'25',
'00001',
'2u7wx6fd94fd',
'f',
preg_split('/\./','10.2.1.1', -1, PREG...
Given a start and end line number, what's the fastest way to read a range of lines from a file into a variable?
...
Possible Duplicate:
How can I read lines from the end of file in Perl?
First read the last line, and then the last but one, etc. The file is too big to fit into memory.
...
Is it possible in to detect in web app run under mod_perl if it is run using ModPerl::Registry?
I want to write script which would run under ModPerl::Registry (or similar handler), but can function also as mod_perl response handler.
...
I can't seem to find a good example of how to do this properly, the ones I have found aren't working for me.. I am trying to submit a form using perl mechanize, where the form has an image file, the form is as below, its actually a way I am trying to access this API for a website from which I have an account and using POST seems to be th...
%data = (
'digits' => [1, 2, 3],
'letters' => ['a', 'b', 'c']
);
How can I push '4' into $data{'digits'}?
I am new to Perl. Those $, @, % symbols look weird to me; I come from a PHP background.
...
How do I extract just the IP addresses from a text file which has an IP address per line? I would like to extract the IPs and then list the IP addresses in a separate file. The text file that contains the IPs are in the following format:
Host somehost.com (192.168.1.1) is up (0.20s latency).
Host 10.1.0.0 is up (0.21s latency).
Host 17...
Does Perl have a build-in function to get the index of an element in an array? Or I need write such a function by myself? [ equivalent to PHP array_search() or JavaScript array.indexOf() ]
...
Could someone provide ideas how HTTP::Proxy module is compared to others proxies like paros and burp proxy and if someone use it during his work specifically if it used by the pen testing community for real job
...
I have one file, and I need everything that is written in some time frame to that file to be written to a second file.
What is the best way to do so? Open some thread that will read the file and do so ?
Any ideas ?
...
I'd like to know what ENDOFTEXT means in this Perl script:
print <<ENDOFTEXT;
HTTP/1.0 200 OK
Content-Type: text/html
<HTML>
<HEAD><TITLE>Hello World!</TITLE></HEAD>
<BODY>
<H4>Hello World!</H4>
<P>You have reached <a href="$url">$url</a></P>
<P>Your IP Address is $ip</P>
<H5>Have a nice day!</H5>
</BODY>
</HTML>
ENDOFTEXT
exit(0);
...
I'm looking for a simple way to determine whether a system is 32- or 64-bit from within Perl 5. I have read the perlvar manual page backwards and forwards, and have not discovered a variable that contains the system's CPU architecture (the CPU architecture Perl was compiled for will come close enough). This is the closest I have come:
c...
use strict;
my $var = NULL;
will raise an error of Bareword "NULL" not allowed while "strict subs" in use
...
my question is: how to pass some arguments to XML:Twig's handler, and how to return the result from the handler.
Here is my code, which hardcoded:
<counter name = "music", report type = "month", stringSet index = 4>.
How to implement this by using arguments $counter_name, $type, $id? and how to return the result of string_list? Than...
I'm new to Perl.
I dowloaded a perl application, that has such a line in a source file:
use PWING::Utils::Utils;
It imports a file as it seems.
I downloaded a plugin for Eclipse [Perl-Eclipse integration].
When I try to start that file as a perl app, it says it cannot find an imported resource.
Now the question is, what a perl pa...
Possible Duplicate:
automatically get loop index in foreach loop in perl
I'd like to iterate over an array, but I need to keep track of the index. This code doesn't list the indexes as I'd expect - how can I fix it?
$arr = [0,0,0,0];
foreach $i (0 .. scalar @$arr) { print $i; }
...
I'm using perl, and I want others to find certain issues on my site using google. How can I do that?
In wordpress (php) there is this option:
I would like my blog to be visible to
everyone, including search engines
(like Google, Bing, Technorati) and
archivers
I would like to do the same using perl.
...