catchDate

2005-09-08 Thread Christopher Spears
I want to catch the various parts of the output of the date command. Here is my script: #!/usr/bin/perl -w use strict; my $date = system("date"); $date =~ /(\w+)/; my $day = $1; print "Day: $day\n"; Here is my output: Thu Sep 8 10:22:14 CEST 2005 Day: 0 What is going on? Does this mean t

RE: catchDate

2005-09-08 Thread Charles K. Clarkson
Christopher Spears wrote: : What is going on? Does this mean that nothing was : captured? Test it yourself. if ( $date =~ /(\w+)/ ) { my $day = $1; print "Day: $day\n"; } else { print "Nothing matched.\n"; } __END__ HTH, Charles K. Clarkson -- Mo

Looping over an array of hashes problem

2005-09-08 Thread Graeme McLaren
Morning all, I have a problem that I can't see a way around. Basically I have an array of hashes and I want to get the key and value of each hash but with the following code I'm getting: Type of arg 1 to keys must be hash (not array element) at /usr/lib/perl5/vendor_perl/Purchaser/Common.pm l

Re: catchDate

2005-09-08 Thread Ranish
On Thursday 08 September 2005 13:55, Christopher Spears wrote: > I want to catch the various parts of the output of the > date command. Here is my script: > > #!/usr/bin/perl -w > use strict; > > my $date = system("date"); > > $date =~ /(\w+)/; > > my $day = $1; > > print "Day: $day\n"; > > Here i

Re: catchDate

2005-09-08 Thread Le Sun (Sandy)
Why not use `date' directly?If you want to use perl indeed,how about this: #!/usr/bin/perl -w system("date \"+Day: %d\""); Christopher Spears wrote: I want to catch the various parts of the output of the date command. Here is my script: #!/usr/bin/perl -w use strict; my $date = system("dat

critique me script!

2005-09-08 Thread Christopher Spears
Can you critique my script, please? #!/usr/bin/perl -w use strict; #Automates pinging and checking a blade for the #nrnode. #Usage: checkDemon #Created by Chris Spears 9/7/05 version 1. while (1) { print "Enter a blade number: "; chomp(my $bladeNumber = ); my $blade = "blade-".$bladeNum

RE: critique me script!

2005-09-08 Thread Thomas Bätzler
Christopher Spears <[EMAIL PROTECTED]> asked: > Can you critique my script, please? If the options are alway numeric, you could use numeric comparisons instead of the match operator. That way, you would not have to chomp() the input because the == operator converts yout string to a number while c

Re: Looping over an array of hashes problem

2005-09-08 Thread Jeff Pan
maybe u would try: foreach my $key (keys %{$AoH[$map_loop{$i}]}) { ... } because $AoH[$map_loop{$i}] is just a ref,so u get wrong. On Thu, 08 Sep 2005 09:42:33 +0100, "Graeme McLaren" <[EMAIL PROTECTED]> said: > Morning all, I have a problem that I can't see a way around. Basically I > ha

Re: catchDate

2005-09-08 Thread John W. Krahn
Christopher Spears wrote: > I want to catch the various parts of the output of the > date command. Is there something the date command can do that Perl's localtime(), gmtime(), POSIX::strftime(), etc. cannot do? perldoc -f localtime perldoc -f gmtime perldoc POSIX > Here is my script: > > #!/

Re: catchDate

2005-09-08 Thread Jeff 'japhy' Pinyan
On Sep 8, Christopher Spears said: I want to catch the various parts of the output of the date command. Here is my script: my $date = system("date"); 1. system() does not RETURN the output of a command. 2. backticks -- that is, `...` -- return the output of a command. 3. Perl provides a date

Re: Looping over an array of hashes problem

2005-09-08 Thread John W. Krahn
Graeme McLaren wrote: > Morning all, I have a problem that I can't see a way around. Basically > I have an array of hashes and I want to get the key and value of each > hash but with the following code I'm getting: > > Type of arg 1 to keys must be hash (not array element) at > /usr/lib/perl5/ven

Re: catchDate

2005-09-08 Thread John W. Krahn
Jeff 'japhy' Pinyan wrote: > On Sep 8, Christopher Spears said: > >> I want to catch the various parts of the output of the >> date command. Here is my script: >> >> my $date = system("date"); > > 1. system() does not RETURN the output of a command. > 2. backticks -- that is, `...` -- return the

Re: catchDate

2005-09-08 Thread Gerard Robin
On Thu, Sep 08, 2005 at 01:25:18AM -0700 Christopher Spears wrote: > I want to catch the various parts of the output of the > date command. Here is my script: > > #!/usr/bin/perl -w > use strict; > > my $date = system("date"); with: my $date = localtime; woks fine. > What is going on? Does

%ENV

2005-09-08 Thread Gergely Buday
Hi there, why is the script #!/usr/bin/perl foreach $key (sort keys %ENV) { print "$key=$ENV{$key}\n"; } returns much less variable than $ set using bash? - Gergely -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <

extract web pages from a web site

2005-09-08 Thread José Pedro Silva Pinto
Hi there, I am doing a program in perl to extract some web pages (And copy it to a local file), from a given web address. Which perl module can I use to help me to do this task Thanks José Pinto

Re: extract web pages from a web site

2005-09-08 Thread Jeff Pan
LWP::Simple can do that. On Thu, 8 Sep 2005 14:45:26 +0100, "José Pedro Silva Pinto" <[EMAIL PROTECTED]> said: > Hi there, > > > > I am doing a program in perl to extract some web pages (And copy it to a > local file), from a given web address. > > > > Which perl module can I use to help m

Re: %ENV

2005-09-08 Thread John W. Krahn
Gergely Buday wrote: > Hi there, > > why is the script > > #!/usr/bin/perl > foreach $key (sort keys %ENV) { > print "$key=$ENV{$key}\n"; > } > > returns much less variable than > > $ set > > using bash? set is a bash built-in command which displays shell variables while the enviroment i

Re: %ENV

2005-09-08 Thread Nahalingam Kanakavel
hi, I think that it shows only the exported varaibles. I tried some thing like this ---try this-- 1) add one more variable with your own as prompt$ MY_OWN='name' 2) then run your program your variable MY_OWN will not be in the list but use suffix export infornt of the above line, th

Re: catchDate

2005-09-08 Thread Binish A R
Christopher Spears wrote: I want to catch the various parts of the output of the date command. Here is my script: #!/usr/bin/perl -w use strict; my $date = system("date"); $date =~ /(\w+)/; my $day = $1; print "Day: $day\n"; Here is my output: Thu Sep 8 10:22:14 CEST 2005 Day: 0 What i

array or hash ?

2005-09-08 Thread Gerard Robin
hello, In a array @tab I get $tab[n], but I don't know n. I want to get $tab[n + 1]. I found two ways (there are probably better ways;-)) 1: @tab = qw/bar tabou island mong turlut foo perl/; ($mot1) = grep /tu/, @tab; print $mot1, "\n"; $index = 0; foreach (@tab) { last if $tab[$index] eq $mot1

Re: array or hash ?

2005-09-08 Thread John W. Krahn
Gerard Robin wrote: > hello, Hello, > In a array @tab I get $tab[n], but I don't know n. > > I want to get $tab[n + 1]. perldoc -q "How do I find the first array element for which a condition is true" John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For ad

how to check real no. without including the package and stuff...........

2005-09-08 Thread mayank . ahuja
Mayank Ahuja Assistant System Engineer Tata Consultancy Services Limited Ph:- 044-5816 Cell:- 9283199460 Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com When every thing seems to be coming to ur way u r probably in the wrong lane. Notice: The information contained in this e-mail messa

RE: how to check real no. without including the package and stuff...........

2005-09-08 Thread Timothy Johnson
Is there a question in there? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 08, 2005 12:45 PM To: beginners@perl.org Subject: how to check real no. without including the package and stuff... Personal information and pseudo-le

Re: Exact matching using GREP.

2005-09-08 Thread Jay Savage
On 9/8/05, Sara <[EMAIL PROTECTED]> wrote: > my @present = ('perl', 'perl/chat', 'php', 'php/forums', 'php/counters', > 'perl/search/scripts', 'php'); > > # Getting Results for mySQL query in hashref. > > while (my $row = $sth->fetchrow_hashref) > { > if (grep /$row->{CAT_TITLE}/, @present) { >

Re: %ENV

2005-09-08 Thread Tony Frasketi
I've had problems with this in this the past and found your solution to work as long as I run my script from the bash command line. However if the script is run from a web page, I still do not get the value of the environment variable that I had set from the bash prompt or even in the .profile

Re: %ENV

2005-09-08 Thread Wiggins d'Anconia
Please bottom post Tony Frasketi wrote: > I've had problems with this in this the past and found your solution to > work as long as I run my script from the bash command line. > > However if the script is run from a web page, I still do not get the > value of the environment variable that I h

2-way lookup

2005-09-08 Thread Keenan, Greg John (Greg)** CTR **
Hi, I have a file like: A B C 1aa11bb11cc11 2aa22bb22cc22 3aa33bb33cc33 4aa44bb44cc44 I have two sets of coordinates like (A2, C1) and I need to join them together like aa22cc11 I am going to pull the relevent line for the fi

Re: 2-way lookup

2005-09-08 Thread Jeff Pan
#/usr/bin/perl my $i=0; my %hash; while (<>) { chomp; s/^\s+|\s+$//g; $hash{$i}=[split]; $i++; } print $hash{0}->[0],"\n"; print $hash{1}->[2],"\n"; Is this useful? On Fri, 9 Sep 2005 12:11:33 +1000 , "Keenan, Greg John (Greg)** CTR **" <[EMAIL PROTECTED]> said: > Hi, > > I

sendmail, etc.

2005-09-08 Thread Matthew Sacks
Greetings, I want to send mail from my perl code. (Boy, that's really unusual) I am thinking using mail::mailer. I need a bit more info than what I have so far found in the online documentation (perldoc -q mail). Where I can I find some advice? E.G., there is always an example of code that d

Re: sendmail, etc.

2005-09-08 Thread Chris Devers
On Thu, 8 Sep 2005, Matthew Sacks wrote: > Where I can I find some advice? This list isn't a bad place to start. > E.G., there is always an example of code that defines > a $to argument. but can $to be a list of addresses? > (a group, that is). Can $to be a list of 100 email > addresses? In g

Re: 2-way lookup

2005-09-08 Thread John W. Krahn
Keenan, Greg John (Greg)** CTR ** wrote: > Hi, Hello, > I have a file like: > > A B C > 1aa11bb11cc11 > 2aa22bb22cc22 > 3aa33bb33cc33 > 4aa44bb44cc44 > > I have two sets of coordinates like (A2, C1) and I need to join them > to

Re: 2-way lookup

2005-09-08 Thread John W. Krahn
Jeff Pan wrote: > #/usr/bin/perl use warnings; use strict; > my $i=0; > my %hash; > > while (<>) > { > chomp; > s/^\s+|\s+$//g; > $hash{$i}=[split]; > $i++; You could write those four lines as: $hash{$i++}=[split]; > } > > print $hash{0}->[0],"\n"; > print $hash{1}->[2],

Re: 2-way lookup

2005-09-08 Thread Jeff Pan
Sure,this code is more brief: $hash{$i++}=[split] while (<>); thank u. On Thu, 08 Sep 2005 19:54:11 -0700, "John W. Krahn" <[EMAIL PROTECTED]> said: > Jeff Pan wrote: > > #/usr/bin/perl > > use warnings; > use strict; > > > my $i=0; > > my %hash; > > > > while (<>) > > { > > chomp; > >

RE: 2-way lookup

2005-09-08 Thread Keenan, Greg John (Greg)** CTR **
-Original Message- >> Hi, > >Hello, > >> I have a file like: >> >> A B C >> 1aa11bb11cc11 >> 2aa22bb22cc22 >> 3aa33bb33cc33 >> 4aa44bb44cc44 >> >> I have two sets of coordinates like (A2, C1) and I need to join them >>

Parsing and HTML file

2005-09-08 Thread Nath, Alok (STSD)
Hi all, I want to read the data from an HTML file say Test.htm.For that I want to use HTML::TableExtract. Can anybody send me some pointers to write the script or give me some sample script ? Thanx, Alok. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additiona