Re: Help parsing tab delimited files

2012-04-09 Thread Dr.Ruud
On 2012-04-10 06:05, Rob Dixon wrote: while () { : } is identical to while (readline FILEHANDLE) { : } which compiles as while (defined($_ = readline FILEHANDLE)) { : } Not accurate, you can check with -MO=Deparse. -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org

Re: Help parsing tab delimited files

2012-04-09 Thread Rob Dixon
Jim Gibson wrote: Tiago Hori wrote: Just so I make sure I understand it correctly: So every time I use a while () loop each line of input from the file gets assigned to $_ in each iteration of the loop? Almost. <> is an operator. Each time is evaluated, a line is read from the file and ass

Re: Template::Toolkit question

2012-04-09 Thread Manfred Lotz
On Tue, 10 Apr 2012 01:07:32 +0200 "Jenda Krynicky" wrote: > > Hi all, > > Let's say I use Template:Toolkit like this: > > > > <-snip---> > > #! /usr/bin/perl > > > > use strict; > > use warnings; > > > > use Template; > > > > my $variables = { nrme => "Manfred

Re: Template::Toolkit question

2012-04-09 Thread Manfred Lotz
On Mon, 09 Apr 2012 17:03:13 -0400 Uri Guttman wrote: > On 04/09/2012 02:28 PM, Manfred Lotz wrote: > > Hi all, > > Let's say I use Template:Toolkit like this: > > > > <-snip---> > > #! /usr/bin/perl > > > > use strict; > > use warnings; > > > > use Template; > > >

Re: split

2012-04-09 Thread John W. Krahn
Matthew Bonner wrote: Hi Anamika I know this thread has focussed on using split -- thought I'd add a regex powered version for reference/comparison. cheers Matthew use strict; use warnings; while () { my @keys; @keys = $_ =~ m/(NM_\d+)+/g; $_ =~ m/\:1\s+(.*)$/;

Re: Help parsing tab delimited files

2012-04-09 Thread John W. Krahn
Jim Gibson wrote: On 4/9/12 Mon Apr 9, 2012 12:22 PM, "Tiago Hori" scribbled: Hey Jim, Makes perfect sense now. Thanks. Just so I make sure I understand it correctly: So every time I use a while () loop each line of input from the file gets assigned to $_ in each iteration of the loop? Al

Re: split

2012-04-09 Thread Matthew Bonner
Hi Anamika I know this thread has focussed on using split -- thought I'd add a regex powered version for reference/comparison. cheers Matthew use strict; use warnings; while () { my @keys; @keys = $_ =~ m/(NM_\d+)+/g; $_ =~ m/\:1\s+(.*)$/; print "$_ = $1\n"

Re: Template::Toolkit question

2012-04-09 Thread Jenda Krynicky
To: beginners@perl.org From: Manfred Lotz Subject:Template::Toolkit question Date sent: Mon, 9 Apr 2012 20:28:14 +0200 > Hi all, > Let's say I use Template:Toolkit like this: > > <-snip---> > #! /u

Re: Template::Toolkit question

2012-04-09 Thread Uri Guttman
On 04/09/2012 02:28 PM, Manfred Lotz wrote: Hi all, Let's say I use Template:Toolkit like this: <-snip---> #! /usr/bin/perl use strict; use warnings; use Template; my $variables = { nrme => "Manfred", }; my $cmd = 'Hi [% name %], how are you.'; my $template

Re: regex

2012-04-09 Thread Somu
WOW!!! Still to see the world... Thanks :) On Mon, Apr 9, 2012 at 4:04 AM, John W. Krahn wrote: > Somu wrote: > >> Hello everyone... >> > > Hello, > > > Thanks for the previous replies. I'm really improving! >> A new problem.. >> >> Check if the word begins with un or in and has exactly 5 lette

Re: Help parsing tab delimited files

2012-04-09 Thread Jim Gibson
On 4/9/12 Mon Apr 9, 2012 12:22 PM, "Tiago Hori" scribbled: > Hey Jim, > > Makes perfect sense now. Thanks. > > Just so I make sure I understand it correctly: So every time I use a while > () loop each line of input from the file gets assigned to $_ in > each iteration of the loop? Almost.

Re: Help parsing tab delimited files

2012-04-09 Thread Tiago Hori
Hey Jim, Makes perfect sense now. Thanks. Just so I make sure I understand it correctly: So every time I use a while () loop each line of input from the file gets assigned to $_ in each iteration of the loop? Cheers, Tiago On Mon, Apr 9, 2012 at 1:00 PM, Jim Gibson wrote: > At 10:21 AM -0230

Re: Use of SFTP::Foreign with backend processing and having problems ( not apparent within the code ) in getting remote SFTP to quit it's processes

2012-04-09 Thread Wagner, David --- Sr Programmer Analyst --- CFS
>-Original Message- >From: Chris Charley [mailto:char...@pulsenet.com] >Sent: Monday, April 09, 2012 9:02 >To: beginners@perl.org >Subject: [Marketing Mail] Re: Use of SFTP::Foreign with backend processing >and having problems ( not apparent within the code ) in getting remote SFTP >to quit

Re: Template::Toolkit question

2012-04-09 Thread Manfred Lotz
On Mon, 9 Apr 2012 20:28:14 +0200 Manfred Lotz wrote: > Hi all, > Let's say I use Template:Toolkit like this: > > <-snip---> > #! /usr/bin/perl > > use strict; > use warnings; > > use Template; > > my $variables = { nrme => "Manfred", }; > > my $cmd = 'Hi [% n

Re: Template::Toolkit question

2012-04-09 Thread Brendan Gilroy
In before actually helpful people: This script with an added "OR" (viz. || "::ERR:Cannot print value::") works as you'd expect #! /usr/bin/perl use strict; use warnings; use Template; my $variables = { nrme => "Manfred", }; my $cmd = 'Hi [% name || "::ERR:Cannot substitute variable::" %], how

Re: Use of SFTP::Foreign with backend processing and having problems ( not apparent within the code ) in getting remote SFTP to quit it's processes

2012-04-09 Thread Chris Charley
""Wagner, David --- Sr Programmer Analyst --- CFS"" wrote in message I am running AS 5.10.1 on Windows XP SP3 and attempting to use sFTP within my processing communicating to MVS/IBM. What I am trying to do is to do so many gets, then undef the variable and re-login and to continue on to end

Template::Toolkit question

2012-04-09 Thread Manfred Lotz
Hi all, Let's say I use Template:Toolkit like this: <-snip---> #! /usr/bin/perl use strict; use warnings; use Template; my $variables = { nrme => "Manfred", }; my $cmd = 'Hi [% name %], how are you.'; my $template = Template->new(); $template->process(\$cmd, $

Re: Help parsing tab delimited files

2012-04-09 Thread Jim Gibson
At 10:21 AM -0230 4/9/12, Tiago Hori wrote: Sorry guys, Another quick question: I got this from perlmonks: #!/usr/bin/perl -w use strict; my @desired_cols = qw(colname1 colname3); #order matters here # reads first line to get actual column names my $header_line = (); my @actual_cols = split(/\

Re: foreach and next

2012-04-09 Thread Rob Dixon
On 09/04/2012 14:24, Vyacheslav wrote: My code my %attr = ( PrintError => 0, RaiseError => 0 ); my $dbh = DBI->connect($dsn, $user, $pass, \%attr); unless ($dbh) { next; } my $query = "SHOW DATABASES"; I use unless ($dbh) { next; } and this work fine. Thanks 09.04.2012 01:22, Jim Gibson напи

Re: foreach and next

2012-04-09 Thread Vyacheslav
My code my %attr = ( PrintError => 0, RaiseError => 0 ); my $dbh = DBI->connect($dsn, $user, $pass, \%attr); unless ($dbh) { next; } my $query = "SHOW DATABASES"; I use unless ($dbh) { next; } and this work fine. Thanks 09.04.2012 01:22, Jim Gibson написал: At 12:50 AM + 4/9/12, Vyachesl

Re: Help parsing tab delimited files

2012-04-09 Thread Tiago Hori
Sorry guys, Another quick question: I got this from perlmonks: #!/usr/bin/perl -w use strict; my @desired_cols = qw(colname1 colname3); #order matters here # reads first line to get actual column names my $header_line = (); my @actual_cols = split(/\s+/,$header_line); # get column number of the

Re: Help parsing tab delimited files

2012-04-09 Thread Tiago Hori
Hi All, Thanks for all your inputs. Part of the problem I was having is that I was creating tab delimited files in excel and I forgot the excel uses a different way to create newlines, right? I remember having the same issue with MySQL. Now, i got it working! Is there way around this issue? Tha

Re: a question about @ISA

2012-04-09 Thread 'lesleyb'
On Mon, Apr 09, 2012 at 12:59:04PM +0300, Shlomi Fish wrote: > Hi xiaolan, > > On Mon, 9 Apr 2012 16:13:36 +0800 > xiaolan wrote: > > > Hi, > > > > I just want to send email using MIME::Lite with Net::SMTP::SSL. > > But MIME::Lite is going only with Net::SMTP by default. > > So I searched and f

Re: Problems: UTF8 charset and print on line from data extract

2012-04-09 Thread Shlomi Fish
Hi Fabrizio, see below for my response. On Fri, 6 Apr 2012 03:30:46 -0700 (PDT) Fabrizio Di Carlo wrote: > Hello to all, > > I'm very newbie of Perl but every I'm understanding how is powerful this > language, but I have a problem: > > I'm using Perl with Selenium for scraping data (for a jo

Re: stacked processing

2012-04-09 Thread Uri Guttman
On 04/08/2012 01:08 AM, Bryan Harris wrote: Hello there! I love perl's ability to "stack" processing without intermediate variables, e.g. to read in a pipe, strip off commented lines, pull out column 5, and join, I can just do this: $txt = join "", map { (split)[4] } grep { !/^#/ }<>; Wha

Re: Deleting Lines From File

2012-04-09 Thread Shlomi Fish
Hi ExecMan, On Thu, 5 Apr 2012 13:44:57 -0700 (PDT) ExecMan wrote: > Hi, > > We have a Perl script that sends out emails. It reads a sequential > file and sends out the emails. The file is big, like 500,000 lines. > > Sometimes this process has gone down and it is a pain to see whom > we've

Re: Deleting Lines From File

2012-04-09 Thread Binish A.R
So these files contain email addresses or something else? In any case, you may store the line number of the last read email address in a separate file, say status.log. When the process starts, check for the existences of this file, and read the content ( may be last line or first line, depends on

Re: stacked processing

2012-04-09 Thread Dr.Ruud
On 2012-04-08 07:08, Bryan Harris wrote: I love perl's ability to "stack" processing without intermediate variables, e.g. to read in a pipe, strip off commented lines, pull out column 5, and join, I can just do this: $txt = join "", map { (split)[4] } grep { !/^#/ }<>; What I haven't figure

Re: stacked processing

2012-04-09 Thread Shlomi Fish
Hi Bryan, On Sun, 08 Apr 2012 00:08:48 -0500 Bryan Harris wrote: > > > Hello there! > > I love perl's ability to "stack" processing without intermediate variables, > e.g. to read in a pipe, strip off commented lines, pull out column 5, and > join, I can just do this: > > $txt = join "", ma

stacked processing

2012-04-09 Thread Bryan Harris
Hello there! I love perl's ability to "stack" processing without intermediate variables, e.g. to read in a pipe, strip off commented lines, pull out column 5, and join, I can just do this: $txt = join "", map { (split)[4] } grep { !/^#/ } <>; What I haven't figured out is how to do a substit

Deleting Lines From File

2012-04-09 Thread ExecMan
Hi, We have a Perl script that sends out emails. It reads a sequential file and sends out the emails. The file is big, like 500,000 lines. Sometimes this process has gone down and it is a pain to see whom we've sent to and whom we have not. Is there a way within the script to remove the addres

Problems: UTF8 charset and print on line from data extract

2012-04-09 Thread Fabrizio Di Carlo
Hello to all, I'm very newbie of Perl but every I'm understanding how is powerful this language, but I have a problem: I'm using Perl with Selenium for scraping data (for a job) the code looks like this [code] use strict; use warnings; use Time::HiRes qw(sleep); use Test::WWW::Selenium; use T

Re: a question about @ISA

2012-04-09 Thread Shlomi Fish
Hi xiaolan, On Mon, 9 Apr 2012 16:13:36 +0800 xiaolan wrote: > Hi, > > I just want to send email using MIME::Lite with Net::SMTP::SSL. > But MIME::Lite is going only with Net::SMTP by default. > So I searched and found a hack: > > use Net::SMTP::SSL; > BEGIN { @MIME::Lite::SMTP::ISA = qw(Net::

Re: a question about @ISA

2012-04-09 Thread 'lesleyb'
On Mon, Apr 09, 2012 at 04:13:36PM +0800, xiaolan wrote: > Hi, > > I just want to send email using MIME::Lite with Net::SMTP::SSL. > But MIME::Lite is going only with Net::SMTP by default. > So I searched and found a hack: > > use Net::SMTP::SSL; > BEGIN { @MIME::Lite::SMTP::ISA = qw(Net::SMTP::S

Re: Help parsing tab delimited files

2012-04-09 Thread Dr.Ruud
On 2012-04-09 03:12, Tiago Hori wrote: Is there any way that I could parse a row at a time while ( <$fh> ) { $_ eq 'foo' and print "$.:$_\n" for split /\t/; } -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@p

a question about @ISA

2012-04-09 Thread xiaolan
Hi, I just want to send email using MIME::Lite with Net::SMTP::SSL. But MIME::Lite is going only with Net::SMTP by default. So I searched and found a hack: use Net::SMTP::SSL; BEGIN { @MIME::Lite::SMTP::ISA = qw(Net::SMTP::SSL); } This does work, now I can send messages with SMTPs. But how does