Re: Conditional replace

2008-10-22 Thread John W. Krahn
Brian wrote: Partial success. The value is normally located starting at the 35th char into the line. I split the line so it was at the beginning of a new line and with> worked. Unfortunately the dates never changed. I will sleep on this and attack it again in the morning. Based on the exam

Re: Conditional replace

2008-10-22 Thread John W. Krahn
Brian wrote: Brian wrote: John W. Krahn wrote: Brian wrote: #!/usr/bin/perl use warnings; use strict; @ARGV == 3 or die "usage: $0 \n"; my ( $search, $replace, $date ) = @ARGV; my ( $day, $mon, $year ) = ( localtime )[ 3, 4, 5 ]; my $today = sprintf '%02d/%02d/%04d', $day, $mon + 1, $

Re: Conditional replace

2008-10-22 Thread Brian
Brian wrote: Brian wrote: John W. Krahn wrote: Brian wrote: Hi Hello, #!/usr/bin/perl use warnings; use strict; @ARGV == 3 or die "usage: $0 \n"; my ( $search, $replace, $date ) = @ARGV; my ( $day, $mon, $year ) = ( localtime )[ 3, 4, 5 ]; my $today = sprintf '%02d/%02d/%04d', $day

Re: Conditional replace

2008-10-22 Thread Brian
Brian wrote: John W. Krahn wrote: Brian wrote: Hi Hello, #!/usr/bin/perl use warnings; use strict; @ARGV == 3 or die "usage: $0 \n"; my ( $search, $replace, $date ) = @ARGV; my ( $day, $mon, $year ) = ( localtime )[ 3, 4, 5 ]; my $today = sprintf '%02d/%02d/%04d', $day, $mon + 1, $y

Re: Conditional replace

2008-10-22 Thread Brian
John W. Krahn wrote: Brian wrote: Hi Hello, #!/usr/bin/perl use warnings; use strict; @ARGV == 3 or die "usage: $0 \n"; my ( $search, $replace, $date ) = @ARGV; my ( $day, $mon, $year ) = ( localtime )[ 3, 4, 5 ]; my $today = sprintf '%02d/%02d/%04d', $day, $mon + 1, $year + 1900; (

Re: form generator Perl... (The Holy Grail)

2008-10-22 Thread Wiggins d'Anconia
Pat Rice wrote: > Hi all > I'm wondering whats the best tool (preferably) open source, To use to > generate HTML forms in Perl that I can link in to a database after, > with optimistically code that is generated in a readable way. > > The holy grail would be: > - type out the form names for each

Re: Conditional replace

2008-10-22 Thread John W. Krahn
Brian wrote: Hi Hello, ARGV0 will = AB7Z001 ARGV1 will = AB7Z002 ARGV2 will = 01/01/1900 I would like to read a file, locate AB7Z001 (but not AB7Z0011, so a space at position 8 in string ) Upon location of value in argv0 replace it with argv1. Then, at the first instance of a date replace

form generator Perl... (The Holy Grail)

2008-10-22 Thread Pat Rice
Hi all I'm wondering whats the best tool (preferably) open source, To use to generate HTML forms in Perl that I can link in to a database after, with optimistically code that is generated in a readable way. The holy grail would be: - type out the form names for each value. - press the button or r

Re: Using a variable in a =~ match??

2008-10-22 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi John, I picked up the Perl book last week so all of your whys will get one answer. "Because that the way I thought it would work!" There are a *lot* of Perl books out there. Which one in particular did you pick up? perldoc -q "How do I find yesterday.s date"

Re: Conditional replace

2008-10-22 Thread brian54321uk
Rob Coops wrote: open (IN, "+; close IN; for ( my $i = 0; $i < scalar @file; $i++ ) { # loop trought the file line by line if ( $file =~ m/$ARGV0/g ) { # look for argument $ARGV0 $file =~ s/$ARGV0(\b.*)/$ARGV1$1/g; # replace argument $ARGV0 with $ARGV1 $file =~ s/(.*?)(\d{2}/\d{2}/\d{2}

Re: XML::Simple question

2008-10-22 Thread Richard Lee
Rob Dixon wrote: Richard Lee wrote: while trying to study the article on perlmonks.org, http://perlmonks.org/?node_id=490846 regarding XML parsing, I need bit of clarfication. how do I parse out http://www.oreilly.com/catalog/covers/perlbp.s.gif"; width="145" height="190" />

Re: Using a variable in a =~ match??

2008-10-22 Thread [EMAIL PROTECTED]
On Oct 21, 10:57 pm, [EMAIL PROTECTED] (John W. Krahn) wrote: > [EMAIL PROTECTED] wrote: > > Hi all, > > Hello, > > > Serious noob here (one week into llama 5th ed.). > > > I'm trying to write a script to pull a specific file from a directory > > and search that file for specific phrases. I am havi

Re: using algorithm-permute

2008-10-22 Thread Sharan Basappa
On Wed, Oct 22, 2008 at 4:32 AM, Rob Dixon <[EMAIL PROTECTED]> wrote: > Sharanbr wrote: >> On Oct 19, 6:38 am, [EMAIL PROTECTED] (Sisyphus) wrote: >>> On Oct 17, 3:04 am, [EMAIL PROTECTED] (Sharan Basappa) wrote: #!/usr/bin/perl use warnings; use Algorithm::Permute; my @arr

Re: Conditional replace

2008-10-22 Thread Brian
From: Rob Coops <[EMAIL PROTECTED]> To: beginners@perl.org Sent: Wednesday, October 22, 2008 3:24:12 PM Subject: Re: Conditional replace On Wed, Oct 22, 2008 at 3:38 PM, Brian <[EMAIL PROTECTED]> wrote: > Hi > > ARGV0 will = AB7Z001 > ARGV1 will = AB7Z002 > A

Re: Conditional replace

2008-10-22 Thread Rob Coops
On Wed, Oct 22, 2008 at 3:38 PM, Brian <[EMAIL PROTECTED]> wrote: > Hi > > ARGV0 will = AB7Z001 > ARGV1 will = AB7Z002 > ARGV2 will = 01/01/1900 > > I would like to read a file, locate AB7Z001 (but not AB7Z0011, so a space > at position 8 in string ) > Upon location of value in argv0 replace it w

Conditional replace

2008-10-22 Thread Brian
Hi ARGV0 will = AB7Z001 ARGV1 will = AB7Z002 ARGV2 will = 01/01/1900 I would like to read a file, locate AB7Z001 (but not AB7Z0011, so a space at position 8 in string ) Upon location of value in argv0 replace it with argv1. Then, at the first instance of a date replace it with argv2. Then, at t

Re: Reading from multiple sockets.

2008-10-22 Thread John W. Krahn
Kammen van, Marco, Springer SBM NL wrote: From: Peter Scott [mailto:[EMAIL PROTECTED] Subject: Re: Reading from multiple sockets. On Tue, 21 Oct 2008 12:53:53 +0200, Kammen van, Marco, Springer SBM NL wrote: I'm pretty new to working with sockets in perl, looked around for days for a proper

Re: :Simple question

2008-10-22 Thread Rob Dixon
Jack Butchie wrote: > > Wouldn't it be more productive if what the question was was actually > inserted into the subject area. instead of a generic term. Subscribers could > instantly see if it's something they might be interested in instead of > opening the email to see what "Simple Questions"

Re: XML::Simple question

2008-10-22 Thread Rob Dixon
Richard Lee wrote: > while trying to study the article on perlmonks.org, > > http://perlmonks.org/?node_id=490846 > > regarding XML parsing, I need bit of clarfication. > > how do I parse out > > http://www.oreilly.com/catalog/covers/perlbp.s.gif"; > width="145" height="190" /> >

Re: how do I install perl into thumbdrive

2008-10-22 Thread Peter Scott
On Wed, 22 Oct 2008 07:12:52 +0800, itshardtogetone wrote: > I move around quite alot. So how do I install perl into my thumbdrive. I did > a yahoo search and I found one but too technical == > http://www.perlmonks.org/?node=Portable+perl%3A+usb+thumbdrive Look for "Perl on a stick": http://use

Re: $o->document vs $o->document()

2008-10-22 Thread Peter Scott
On Tue, 21 Oct 2008 10:38:27 -0400, Jay Savage wrote: > On Thu, Oct 9, 2008 at 6:04 AM, Peter Scott <[EMAIL PROTECTED]> wrote: >> On Wed, 08 Oct 2008 04:59:19 -0700, John W. Krahn wrote: >>> perldoc perlsub >>> >>> To call subroutines: >>> >>> NAME(LIST);# & is optional with paren

RE: Reading from multiple sockets.

2008-10-22 Thread Kammen van, Marco, Springer SBM NL
>>From: Peter Scott [mailto:[EMAIL PROTECTED] >>Subject: Re: Reading from multiple sockets. >On Tue, 21 Oct 2008 12:53:53 +0200, Kammen van, Marco, Springer SBM NL >wrote: > I'm pretty new to working with sockets in perl, looked around for days > for a proper solution for my IRC/DCC problem but

Re: Reading from multiple sockets.

2008-10-22 Thread Peter Scott
On Tue, 21 Oct 2008 12:53:53 +0200, Kammen van, Marco, Springer SBM NL wrote: > I'm pretty new to working with sockets in perl, looked around for days > for a proper solution for my IRC/DCC problem but couldn't find one. If you'd like to do this without grubbing around at the socket level, check o

Re: :Simple question

2008-10-22 Thread Jack Butchie
Wouldn't it be more productive if what the question was was actually inserted into the subject area. instead of a generic term. Subscribers could instantly see if it's something they might be interested in instead of opening the email to see what "Simple Questions" actually is. - Original

RE: :Simple question

2008-10-22 Thread Stewart Anderson
> -Original Message- > From: Richard Lee [mailto:[EMAIL PROTECTED] > Sent: 22 October 2008 06:00 > To: Perl Beginners > Subject: XML::Simple question > > while trying to study the article on perlmonks.org, > > http://perlmonks.org/?node_id=490846 > > regarding XML parsing, I need bit of

RE: Send Mail with attachment

2008-10-22 Thread Stewart Anderson
> > Hi All, > > I'm using perl module MIME::Lite to sent out email with attachments, > may I know what "Type" should I define to attach any type of files, > for instance .jpg, .xls, .doc, .pdf and etc without checking the > attached file type. Is there any global variable to define instead of >

Re: last element during foreach loop

2008-10-22 Thread Dr.Ruud
"Vijaya" schreef: > I think there are 3 possible ways to check the last element in your IF > condition inside Foreach loop. > > 1. $list[-1] eq $element > 2. $list[$#list] eq $element > 3. $list[scalar(@list)-1] eq $element Those all will not work (reliably), because you compare the value, and th

Re: last element during foreach loop

2008-10-22 Thread Vijaya
Hi Dave, I think there are 3 possible ways to check the last element in your IF condition inside Foreach loop. 1. $list[-1] eq $element 2. $list[$#list] eq $element 3. $list[scalar(@list)-1] eq $element See the example code and replace the if with other set of conditions given above

Re: XML::Simple question

2008-10-22 Thread Dr.Ruud
Richard Lee schreef: > how do I parse out > > http://www.oreilly.com/catalog/covers/perlbp.s.gif"; > width="145" height="190" /> > > I tried $book->{image}->{src}... but doesn't work.. > > use XML::Simple qw(:strict); > > my $library = XMLin($filename, > ForceArray => 1, >

Re: Send Mail with attachment

2008-10-22 Thread Octavian Rasnita
From: <[EMAIL PROTECTED]> > Hi All, > > I'm using perl module MIME::Lite to sent out email with attachments, > may I know what "Type" should I define to attach any type of files, > for instance .jpg, .xls, .doc, .pdf and etc without checking the > attached file type. Is there any global variable

Re: Send Mail with attachment

2008-10-22 Thread Jeff Pang
2008/10/22 <[EMAIL PROTECTED]>: > Hi All, > > I'm using perl module MIME::Lite to sent out email with attachments, > may I know what "Type" should I define to attach any type of files, > for instance .jpg, .xls, .doc, .pdf and etc without checking the > attached file type. Is there any global var