you can use one of the CPAN modules, called Time::Format.
On 8/9/07, Srinivas <[EMAIL PROTECTED]> wrote:
>
> perldoc -q "How can I compare two dates and find the difference"
>
> Wagner, David --- Senior Programmer Analyst --- WGO wrote:
> >> -Original Message-
> >> From: timbo [mailto:[E
perldoc -q "How can I compare two dates and find the difference"
Wagner, David --- Senior Programmer Analyst --- WGO wrote:
-Original Message-
From: timbo [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 08, 2007 07:03
To: beginners@perl.org
Subject: calculating time difference with l
On Thu, 2007-08-09 at 00:27 -0400, [EMAIL PROTECTED] wrote:
> Hello list,
>
> Just be curious to see how do you guys use Perl for work.Would you be
> pleased to give a vote below?
>
> [a] CGI/Web Development
> [b] System Administration
> [c] mod_perl -- write Apache handler
> [d] write commerci
Hello list,
Just be curious to see how do you guys use Perl for work.Would you be
pleased to give a vote below?
[a] CGI/Web Development
[b] System Administration
[c] mod_perl -- write Apache handler
[d] write commercial products
[e] Biological analysis
[f] others
For me I primarily used it fo
Subject: slices
Your examples are not using slices. A slice implies a list (more than one) of
indexes
oryann9 wrote:
Trying to understand from perldoc perldata the diff
between these 3 CLIs and why the 2nd CLI has no
elements?
From perldata: "A slice of an empty list is still an empty li
Lawrence Statton wrote:
From [EMAIL PROTECTED] Wed Aug 8 15:44:30 2007
Return-Path: <[EMAIL PROTECTED]>
X-Original-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Received: from localhost (localhost [127.0.0.1])
by hummer.cluon.com (Postfix) with ESMTP id 25F66339A0
for <[
Thanks heaps Jeff.
Both Chris and you are legends!
t.
Jeff Pang wrote:
> -Original Message-
> >From: timbo <[EMAIL PROTECTED]>
> >Sent: Aug 8, 2007 1:47 AM
> >To: beginners@perl.org
> >Subject: Timelocal's input parameters
> >
> >Is it possible to pass timelocal a parameter that's already
Hi all,
I have the following perl script that copies files from one folder to
another:
use File::Copy;
my $filename = 'gar';
for my $file ( <*.$filename> ) {
# copy each individual file
move($file, "c:\\Documents\\AudioDownloadsWaiting\\") or die "move
failed: $!";
}
print "Done";
Th
Dan Sopher wrote:
This works in a one-liner:
$string =~ s/^\s*(.*\S)\s*$/$1/;
Cheers!
Let's compare Dan's one-liner to the solutions in the FAQ (perlfaq4):
$ perl -le'
for ( "\nX\n", "\nX", "X\n", "X", "\n\n\n", "\n", "" ) {
$a = $b = $c = $_;
$d = $a =~ s/^\s*(.*\S)\s*$/$1/;
On Jul 27, 12:03 pm, [EMAIL PROTECTED] (Ravi Malghan) wrote:
> Hi: I am looking to build a script that can go to a webpage, login with a
> username/password, download a page, perform a checksum comparison. Two things
> I am trying to accomplish.
>
> 1. Is the website is up
> 2. Has the website be
-Original Message-
>From: oryann9 <[EMAIL PROTECTED]>
>Sent: Aug 9, 2007 4:43 AM
>To: Perl List
>Subject: slices
>
>$ perl -le 'use Data::Dumper; @c = (0,1)[2]; print
>Dumper([EMAIL PROTECTED]);'
>$VAR1 = [];
>
>
This is because the expression of '(0,1)[2]' would return undefined value
-Original Message-
>From: Subhash <[EMAIL PROTECTED]>
>Sent: Aug 8, 2007 10:34 PM
>To: beginners@perl.org
>Subject: Replacing the n'th line with the new line
>
>Hi
>
>Is there any way to update the specified line in the file with the new
>line without having to copy the entire contents on
-Original Message-
>From: Jason <[EMAIL PROTECTED]>
>Sent: Aug 8, 2007 6:59 PM
>To: beginners@perl.org
>Subject: Compare two different files.
>
>HI,
>
>Can I compare the contents of two different files using perl?
>ex: one .txt and other javaobject
>
I don't think they can be compared if
Ken Foskey schreef:
> On Wed, 2007-08-08 at 22:26 +0200, Dr.Ruud wrote:
>> You might be able to change this to creating (and filling) the files
>> in a tmp directory, and move them to the processing directory once
>> they are finished. Then there is no need to have those 0-bytes flag
>> files. A b
Nevada schreef:
> what is [\pL']?
Most probably the same as [[:alpha:]'].
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Andrew Curry schreef:
> /\s*(\S+)\s*=\s*(\S+)[,\s*\/*]?/
Anchored alternative:
/^\s*(\w+)\s*=\s*(\w+)/
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Wed, 2007-08-08 at 22:26 +0200, Dr.Ruud wrote:
> You might be able to change this to creating (and filling) the files in
> a tmp directory, and move them to the processing directory once they are
> finished. Then there is no need to have those 0-bytes flag files. A bit
> like how a maildir work
This works in a one-liner:
$string =~ s/^\s*(.*\S)\s*$/$1/;
Cheers!
-Dan
-Original Message-
From: Dr.Ruud [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 08, 2007 2:05 PM
To: beginners@perl.org
Subject: Re: regex help
Jeff Pang schreef:
> John W. Krahn:
>> Tony Heal:
>>> Why does
Andrew Curry schreef:
> the problem with a daemon is you need to keep checking its
> running
google: inittab respawn telinit
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Jeff Pang schreef:
> John W. Krahn:
>> Tony Heal:
>>> Why doesn't this work? I want to take any leading
>>> or trailing white spaces out.
>>
>> perldoc -q "How do I strip blank space"
>
> Or generally it could be done by,
> $string =~ s/^\s+|\s+$//g;
The g-modifier doesn't mean "generally" no
> From [EMAIL PROTECTED] Wed Aug 8 15:44:30 2007
> Return-Path: <[EMAIL PROTECTED]>
> X-Original-To: [EMAIL PROTECTED]
> Delivered-To: [EMAIL PROTECTED]
> Received: from localhost (localhost [127.0.0.1])
> by hummer.cluon.com (Postfix) with ESMTP id 25F66339A0
> for <[EMAIL PROTECTED]
> -Original Message-
> From: oryann9 [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 08, 2007 13:44
> To: Perl List
> Subject: slices
>
> Trying to understand from perldoc perldata the diff
> between these 3 CLIs and why the 2nd CLI has no
> elements?
>
> $ perl -le 'use Data::Dumper
"Larry Vaden" schreef:
> /vendor_perl/ has Net::DNS version 0.48 and
> /site_perl/ has Net::DNS version 0.61 and if I understand the Net::DNS
> release notes, one wants an SPF-specific fix just released in Net::DNS
> version 0.61.
$ perl -wle 'print for @INC'
$ perldoc -l Net::DNS
$ perl -MNet:
Subhash wrote:
Hi
Is there any way to update the specified line in the file with the new
line without having to copy the entire contents once again. Since the
file is huge, i dont want to re-write the file. Can anyone suggest me
how to do this
If the line you are replacing is the same size as
"Mumia W." schreef:
> Jeff Pang wrote:
>> [...]
>> while(my $obj = readdir DIR) {
>> next if $obj =~ /^\.+$/; #or [...]
>
> More, precisely, you might use this:
>
> next if $obj =~ /\A\.\.?\z/;
Please see `perldoc -f -f`.
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mai
Trying to understand from perldoc perldata the diff
between these 3 CLIs and why the 2nd CLI has no
elements?
$ perl -le 'use Data::Dumper; @c = (0,1)[1]; print
Dumper([EMAIL PROTECTED]);'
$VAR1 = [
1
];
$ perl -le 'use Data::Dumper; @c = (0,1)[2]; print
Dumper([EMAIL PROTECTED]
> -Original Message-
> From: timbo [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 08, 2007 07:03
> To: beginners@perl.org
> Subject: calculating time difference with localtime
>
> Once I calculate the difference between 2 epoch times, is there a way
> I can convert the difference int
Hi
Is there any way to update the specified line in the file with the new
line without having to copy the entire contents once again. Since the
file is huge, i dont want to re-write the file. Can anyone suggest me
how to do this
Thanks
Subhash
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For a
"Mihir Kamdar" schreef:
> There is a parent directory where the input files will be stored.
> These files will keep on coming into the parent directory. There is a
> child directory where these input files will just get touched(0 byte
> files).
You might be able to change this to creating (and fi
Jeff Pang schreef:
> next if $file =~ /^\.+$/;
You'll miss a file called "...".
Consider:
next unless -f "$path/$file";
See `perldoc -f -f`.
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Once I calculate the difference between 2 epoch times, is there a way
I can convert the difference into a proper time format?
For example...
$difference = 13452
then convert it to show
timedifference = 35 minutes
Thanks in advance.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional
I found this weird behavior when using Term::ReadLine::Gnu in a Perl
program called from vim (in linux). When an area in vim is selected (in
visual mode) and an external program is called, the contents of the
selected area act as STDIN for the program, and are overwritten by the
program's output.
HI,
Can I compare the contents of two different files using perl?
ex: one .txt and other javaobject
-Jason
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Ravi Malghan schreef:
> Hi: I am looking to build a script that can go to a webpage, login
> with a username/password, download a page, perform a checksum
> comparison.
Have you considered using curl, or wget?
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECT
-
> No, it is a hash slice.
>
> my %foo;
> @foo{ qw / one two three / } = qw / uno dos tres / ;
>
> is equivalent to
>
> my %foo = ( one => 'uno',
> two => 'dos',
> three => 'tres' );
>
> is equivalent to ...
>
> my %foo;
> $foo{one} = 'uno';
> $foo{two} =
I created the following script to look for files with the .vsp extension and
it looks at the time stamp as well.
I would like to include a display of all the volumes on the windows server
and then search each one of the volumes it finds. Any ideas out there?
use Time::localtime;
#if (@ARGV <
On Aug 8, 11:26 am, [EMAIL PROTECTED] (Oryann9) wrote:
> Is this an array of hashes desingnated by { }?
>
> my %month;
> @month{ qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct
> Nov Dec/ } = 0..11;
No. That is a hash-slice. Just as you identify one value of a hash
by changing the % to a $ and puttin
On 8/8/07, kapil.V <[EMAIL PROTECTED]> wrote:
> Hi,
> I tried this to see if the file is an html:
> perl -ne '!.+?!s and print "html\n"' html.htm
> This does not work. What is the problem?
>
The first problem is that it's not valid Perl; it won't compile. You
should be seeing an error like "Su
>
> Is this an array of hashes desingnated by { }?
>
> my %month;
> @month{ qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct
> Nov Dec/ } = 0..11;
>
No, it is a hash slice.
my %foo;
@foo{ qw / one two three / } = qw / uno dos tres / ;
is equivalent to
my %foo = ( one => 'uno',
t
-Original Message-
>From: oryann9 <[EMAIL PROTECTED]>
>Sent: Aug 8, 2007 11:26 AM
>To: beginners@perl.org
>Subject: Re: Timelocal's input parameters
>
>
>
>> #!/usr/bin/perl
>> use strict;
>> use warnings;
>> use Time::Local;
>>
>> my %month;
>> @month{ qw/Jan Feb Mar Apr May Jun Jul Aug
> #!/usr/bin/perl
> use strict;
> use warnings;
> use Time::Local;
>
> my %month;
> @month{ qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct
> Nov Dec/ } = 0..11;
>
> my $date = "Thu Mar 9 23:04:03 2006";
>
> my (undef, $month, $day, $h, $m, $s, $year) = split
> /\W+/, $date;
>
> my $time =
> time
-Original Message-
>From: timbo <[EMAIL PROTECTED]>
>Sent: Aug 8, 2007 1:47 AM
>To: beginners@perl.org
>Subject: Timelocal's input parameters
>
>Is it possible to pass timelocal a parameter that's already the exact
>scalar output of localtime's format "Mon Jan 10 04:30:30 2007"?
>
>I know
Is it possible to pass timelocal a parameter that's already the exact
scalar output of localtime's format "Mon Jan 10 04:30:30 2007"?
I know the perlfunc documentations for timelocal indicates that
arguments are in the form of ...
timelocal($seconds, $minutes, $hours, $day, $month, $year)
but I
On Aug 8, 2:29 am, [EMAIL PROTECTED] (kapil.V) wrote:
> I tried this to see if the file is an html:
> perl -ne '!.+?!s and print "html\n"' html.htm
> This does not work. What is the problem?
-n repeatedly loops through all lines of the file, each iteration
assigning $_ to be the current line.
Dear Paul, Mumia,
Thank you for you advice! Now my problem has been solved :)
Regards,
Fermín Galán Márquez
CTTC - Centre Tecnològic de Telecomunicacions de Catalunya
Parc Mediterrani de la Tecnologia, Av. del Canal Olímpic s/n, 08860
Castelldefels, Spain
Room 1.02
Tel : +3
From: Sumit Sahu <[EMAIL PROTECTED]>
> Thanks for replying. Trimming the PATH is the last resort. I wanted
> to know if there is a cleaner way of doing things. Actually the PATH
> is indeed needed. I can trim it and then restore it at the end of the
> perl script (the problematic script that is )
On Wed, 2007-08-08 at 11:59 +0530, kapil.V wrote:
> Hi,
> I tried this to see if the file is an html:
> perl -ne '!.+?!s and print "html\n"' html.htm
> This does not work. What is the problem?
The is rarely on the same line as the in a html file so
this will very rarely match.
--
Ken Foske
On Wed, 2007-08-08 at 17:39 +0530, sivasakthi wrote:
> Hi Guys,
>
> I have a very large file. It may be contain 1lac lines.. also it
> length is increased in dynamically..
> Each time ( per 5 min) i need to read the contents from file & do some
> work .. Suppose i have read the lines for first
Hi,
I tried this to see if the file is an html:
perl -ne '!.+?!s and print "html\n"' html.htm
This does not work. What is the problem?
Thanks,
Kapil.V
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Aug 8, 8:09 am, [EMAIL PROTECTED] (Sivasakthi) wrote:
> I have a very large file. It may be contain 1lac lines
Just FYI, that doesn't mean anything outside of India. You might want
to use more conventional numeric notation when posting to an
internation forum. IIRC, 1lac means 10^5, right?
Thanks all guys, in particular for very quick answers :)
Chas, you can read my mind! That's exactly why I hesitated to use crontab.
But your solution is, in short, elegant! I'll try now to modify my script
with Jeff and cpan's Daemon suggestions. And anyhow, I'll do some testing
regarding performa
Agreed but the problem with a daemon is you need to keep checking its
running if it doesn't run then you have no checks, for a database with
critical information this isnt viable, cron for all its problems is part of
the os makeup and can be trusted to run things at a certain time.
In this case t
On 8/8/07, Andrew Curry <[EMAIL PROTECTED]> wrote:
> To be honest in terms of database monitoring cron is usually the way to go.
> The advantage Is that then you don't need to monitor the monitoring program.
> As a DBA you need reliable data in terms of status etc... You could write an
> overcompli
Just to add to it
U also have not put new line character at all
So this will not be counted as line at all
But first may also be the reason but the second seems to be more proper
Bhargav
-Original Message-
From: Mihir Kamdar [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 07, 2007 1
Hi Mihir
Please check line
print $LOG_FILE "Count of cdrs after removing duplicates = $lines" ;
And
print $LOG_FILE "Count of cdrs before removing duplicates = $count" ;
You are not printing new line character at the end
Whenever the first line of any file is to long unix is unable
On 8/8/07, Toddy Prawiraharjo <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I wrote a simple perl script to check some variables in SHOW STATUS in a
> mysql server. Now, how do I run it as a service/daemon?
> I want more flexibility than crontab which is based on time. Should I use
> sleep? Or is there
-Original Message-
>From: Toddy Prawiraharjo <[EMAIL PROTECTED]>
>Sent: Aug 8, 2007 8:12 PM
>To: beginners@perl.org
>Subject: run perl as service
>
>Hi all,
>
>I wrote a simple perl script to check some variables in SHOW STATUS in a
>mysql server. Now, how do I run it as a service/daemon
To be honest in terms of database monitoring cron is usually the way to go.
The advantage Is that then you don't need to monitor the monitoring program.
As a DBA you need reliable data in terms of status etc... You could write an
overcomplicated daemon which monitors its state but if cron is an opt
Hi all,
I wrote a simple perl script to check some variables in SHOW STATUS in a
mysql server. Now, how do I run it as a service/daemon?
I want more flexibility than crontab which is based on time. Should I use
sleep? Or is there any other alternative? Thanks in advance.
Cheers,
Toddy Prawir
On 8/8/07, sivasakthi <[EMAIL PROTECTED]> wrote:
> Hi Guys,
>
> I have a very large file. It may be contain 1lac lines.. also it
> length is increased in dynamically..
> Each time ( per 5 min) i need to read the contents from file & do some
> work .. Suppose i have read the lines for first 5 mi
Hi Guys,
I have a very large file. It may be contain 1lac lines.. also it
length is increased in dynamically..
Each time ( per 5 min) i need to read the contents from file & do some
work .. Suppose i have read the lines for first 5 min then after some
time it reads the same line also , so it
61 matches
Mail list logo