I have an application which generates logs in append mode, but the logs are not timestamped.
Is it possible to use tail -f with some option, or a perl script to monitor writes to this file and prefix them with a timestamp?
Given that I am running Windows without Cygwin, could I avoid using bash or any other Unix shell?
...
The exists function can unexpectedly autovivify entries in hashes.
What surprises me is that this behavior carries over to constants as well:
use strict;
use warnings;
use Data::Dump 'dump';
use constant data => {
'foo' => {
'bar' => 'baz',
},
...
I have a separate servers running with postgres and Nagios. I want to use "psql_replication_check.pl" with nagios to monitor the postgres replication status. This check script requires DBD::Pg module to connect to database. Installation of DBD::Pg asking for the path of pg_config file.
#perl Makefile.PL
Configuring DBD::Pg 2.17.1
Path ...
I'm using Text::MultiMarkdown to print from Perl to HTML.
I would like to create a table where some of the cells contain a few strings, each in a separate line within the cell (see "four five six" in the picture below).
Can I do that?
...
Using Moose, is it possible to create a builder that builds multiple attributes at once?
I have a project in which the object has several 'sets' of fields - if any member of the set is requested, I want to go ahead and populate them all. My assumption is that if I need the name, I'll also need the birthdate, and since they're in the sa...
I'm creating a class which will contain a list of IP addresses, as Net::IP objects.
I've wrapped the Net::IP object as a subtype (IPAddress), and defined a coercion from a string to IPAddress. Then I've added an attribute to the class called ip_list with the type ArrayRef[IPAddress], and delegated to the push method of the Array trait....
Hello all,
Want to read the contents from a .csv file which is in a remote zip file without downloading & extracting the zip file to local machine.
I need this because the file zip file size is too large and downloading it whenever needed
takes longer time.
I am trying this in perl.
My code is :
my $ftp = Net::FTP::AutoReconnect->ne...
The following code
#!/usr/bin/perl
use strict;
use warnings;
my $s1 = '[email protected]';
my $s2 = '[email protected]';
my $s3 = 'aaa2000';
my $s4 = 'aaa_2000';
no locale;
print "\nNO Locale:\n\n";
if ($s1 gt $s2) {print "$s1 is > $s2\n";}
if ($s1 lt $s2) {print "$s1 is < $s2\n";}
if ($s1 eq $s2) {print "$s1 is = $s2\n";}
if ($...
$line = " TEST: asdas :asd asdasad s";
if ($line =~ /(.*):(.*)/
{
print "$1 = $2 "
}
I was expecting TEST =asdas :asd asdasad s
but its not working ? what is issue
...
I have two scripts in which I'm experimenting with CSV_XS. In the first, I hard-coded everything: source directory, filename, and the csv delimiter I wanted to look for. The script works great. In the second, however, I try to dynamically discover as much as possible. That script seems to run, but it outputs nothing.
I'm having trouble...
I have a function (let's call it foo(array_reference, ...)) that expects an array reference among other parameters. I want to have foo shift the array reference off the list of parameters passed to it directly to an array, without having to shift it off as an array reference and then separately convert that to an array.
What I want shou...
I've been looking at the various ways of constructing lazy lists in Perl 6 and I would like to collect all of the concise ways of describing the Fibonacci sequence.
I will start this off with the three from masak's journal:
my @fibs := (0, 1, -> $a, $b { $a + $b } ... *);
my @fibs := (0, 1, { $^a + $^b } ... *);
my @fibs := (0, 1, ...
I'm writing a Perl script in which I need to loop over each character of a string. There's a lot of strings, and each is 100 characters long (they're short DNA sequences, in case you're wondering).
So, is it faster to use substr to extract each character one at a time, or is it faster to split the string into an array and then iterate o...
Is it possible to detect if any sound plays on a windows xp machine? Help in any language would be useful. I basically need to write a program that runs all the time and outputs some text to a file whenever a sound plays. I don't need any specific information about the sound, just whether a sound is playing. I don't care whether the ...
How do I pass a variable into a URL in a Perl script?
I am trying to pass the variables in an array to url. For some reason it is not working. I am not sure what I am doing wrong. The code roughly looks like this:
@coins = qw(Quarter Dime Nickel);
foreach (@coins) {
my $req = HTTP::Request->new(POST =>'https://url/$coins.com');
} ...
I recently started working on a web project which was already in progress; the guy who built the foundation for it had the signup page sending the form fields to a formmail Perl script, so that he could get an email when a user signs up. I'm not familiar with Perl, and my inclination is to just use the PHP mail() function and drop the ...
Sorry for the vague question .
I have a perl gui built in tk in linux . And I have built a text box in it . I wan to show the ouput of the perl script into the text box , including the errors or warnings that show up on the terminal when the perl script is run . How to do it ?
...
$ cat temp.pl
use strict;
use warnings;
print "1\n";
print "hello, world\n";
print "2\n";
print "hello,
world\n";
print "3\n";
print "hello, \
world\n";
$ perl temp.pl
1
hello, world
2
hello,
world
3
hello,
world
$
To make my code easily readable, I want to restrict the number of columns to 80 characters. How can I break a line of...
hi..
here is my perl script(a.pl)
#!/usr/bin/perl
$logfile = "./a.log";
open(LOGFILE_Handle, ">$logfile") or die "Error : Can not open $logfile !!! \n\n ";
print LOGFILE_Handle "a.pl: 1 ";
system "./a.exp ";
here is my expect script(a.exp)
#!/opt/sfw/bin/expect -f
log_user 1;
set logfile "./a.log";
set LOGFILE_Handle [open "$log...
If I run
"Year 2010" =~ /([0-4]*)/;
print $1;
I get empty string.
But
"Year 2010" =~ /([0-4]+)/;
print $1;
outputs "2010". Why?
...