Re: loop does select next line

2014-07-05 Thread Kent Fredric
On 6 July 2014 02:31, Sunita Pradhan wrote: > I have a set of code for count number of lines and number of words . > > #!/usr/bin/perl > > while ($line = ){ > chomp ($line); > $hash{L_c_start}++ if ($line =~ /^C.*/i); > @words = split /\s+/,$line; > *foreach $c (k

loop does select next line

2014-07-05 Thread Sunita Pradhan
I have a set of code for count number of lines and number of words . #!/usr/bin/perl while ($line = ){ chomp ($line); $hash{L_c_start}++ if ($line =~ /^C.*/i); @words = split /\s+/,$line; foreach $c (keys @words){ print "word $words[$c]\n";

Re: Next subnet

2013-05-27 Thread Dr.Ruud
On 27/05/2013 23:55, shawn wilson wrote: On May 27, 2013 1:02 PM, "Dr.Ruud" mailto:rvtol%2buse...@isolution.nl>> wrote: > On 26/05/2013 14:40, shawn wilson wrote: >> Thank y'all, I got to where I want to be: >> https://github.com/ag4ve/geocidr > > > ... > > or grep { ! m%[0-9\.\/]+% } @{

Re: Next subnet

2013-05-27 Thread shawn wilson
On May 27, 2013 1:02 PM, "Dr.Ruud" wrote: > > On 26/05/2013 14:40, shawn wilson wrote: > >> Thank y'all, I got to where I want to be: >> https://github.com/ag4ve/geocidr > > > > ... > > or grep { ! m%[0-9\.\/]+% } @{$opts->{ip}} > > or scalar(@{$opts->{ip}}) < 1 > > The '+' in the regexp is superf

Re: Next subnet

2013-05-27 Thread Dr.Ruud
On 26/05/2013 14:40, shawn wilson wrote: Thank y'all, I got to where I want to be: https://github.com/ag4ve/geocidr > ... > or grep { ! m%[0-9\.\/]+% } @{$opts->{ip}} > or scalar(@{$opts->{ip}}) < 1 The '+' in the regexp is superfluous as-is. (your regexp isn't anchored) You probably meant

Re: Next subnet

2013-05-26 Thread shawn wilson
Thank y'all, I got to where I want to be: https://github.com/ag4ve/geocidr On Sun, May 26, 2013 at 8:06 AM, Michael Rasmussen wrote: > On Fri, May 24, 2013 at 03:18:35PM -0400, shawn wilson wrote: >> How do I find the next subnet? This should print 192.168.1.0 the >> sec

Re: Next subnet

2013-05-26 Thread Michael Rasmussen
On Fri, May 24, 2013 at 03:18:35PM -0400, shawn wilson wrote: > How do I find the next subnet? This should print 192.168.1.0 the > second time - it errors: [code deleted] Why should it? The Net::IP documentation doesn't provide any information about actions that cross the subnet bound

Re: Next subnet

2013-05-25 Thread Dr.Ruud
On 24/05/2013 21:18, shawn wilson wrote: How do I find the next subnet? This should print 192.168.1.0 the second time - it errors: #!/usr/bin/env perl use strict; use warnings; use Net::IP; my $ip = Net::IP->new('192.168.0.0/24'); print "Start ip [" . $ip->ip

Next subnet

2013-05-24 Thread shawn wilson
How do I find the next subnet? This should print 192.168.1.0 the second time - it errors: #!/usr/bin/env perl use strict; use warnings; use Net::IP; my $ip = Net::IP->new('192.168.0.0/24'); print "Start ip [" . $ip->ip . "]\n"; print "start mask [

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.201

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

Re: foreach and next

2012-04-08 Thread Jim Gibson
At 12:50 AM + 4/9/12, Vyacheslav wrote: I enabled RaiserError, then script die. ... my %attr = ( PrintError => 0, RaiseError => 1 ); Use: RaiseError => 0 instead so that your script will not raise an exception and die. Then check $dbh->err. -- To unsubscribe, e-mail: beginne

Re: foreach and next

2012-04-08 Thread Vyacheslav
I enabled RaiserError, then script die. ... my %attr = ( PrintError => 0, RaiseError => 1 ); my $dbh = DBI->connect($dsn, $user, $pass, \%attr); # or die "Can't connect to the DB: $DBI::errstr\n"; my $query = "SHOW DATABASES"; my $sth = $dbh->prepare($query) or die "Can't prepare SQL st

Re: foreach and next

2012-04-08 Thread Dr.Ruud
On 2012-04-08 17:10, Vyacheslav wrote: using eval helped me. You should not use exceptions for normal code flow. Read the DBI docs (perldoc DBI). If a failed connection must be an exception, set RaiseError to true. But if it isn't an exception, leave it false, and test $dbh->err (or the glob

Re: foreach and next

2012-04-08 Thread Shlomi Fish
Hi Vyacheslav, On Sun, 08 Apr 2012 15:10:06 + Vyacheslav wrote: > Thanks all. > > using eval helped me. > The problem with eval in Perl 5 is that it catches any and all thrown exceptions . I.e: by default, it doesn't do Object-Oriented exceptions like Java, Ruby, Python and other language

Re: foreach and next

2012-04-08 Thread Vyacheslav
Since this exception is not caught (using eval { ... }) it terminates the entire program. So what you should do instead is handle it gracefully (say using "next"): my $dbh = DBI->connect($dsn, $user, $pass); if (!$dbh) { next DB_HOSTS_LOOP; # And label the loop appropriately. }

Re: foreach and next

2012-04-08 Thread Shlomi Fish
www.socialtext.net/perl5/exception_handling Since this exception is not caught (using eval { ... }) it terminates the entire program. So what you should do instead is handle it gracefully (say using "next"): my $dbh = DBI->connect($dsn, $user, $pass); if (!$dbh) {

Re: foreach and next

2012-04-08 Thread Binish A.R
"host $db - not ok"; } else {         print "host $db - ok"; }   http://www.gnome.org/friends/banners/associate.png"; alt="Become a Friend of GNOME" border="0" /> From: Vyacheslav To: beginners@perl.org Sent: Sund

foreach and next

2012-04-07 Thread Vyacheslav
st db3 - ok DBI connect('information_schema:db4:3306','user',...) failed: Can't connect to MySQL server on 'db4' (111) at ./dbcheck.pl line 53 and script die How I can pass an error that the cycle has continued execute? I need host db1 - ok host db2 - ok host db3 - o

Re: How Could I print the next line after a REGEX match?

2011-11-26 Thread Shlomi Fish
p($line); > if ($line =~ /NetBIOS\ name\ :\ <\/td>/){ You don't have to escape =, " and whitespace. If you have "/"s in the string, you can use a different delimiter: if ($line =~ m{...}) Also it seems you're looking for a substring. For that you

How Could I print the next line after a REGEX match?

2011-11-26 Thread Raito Garcia
uot;Report.html") || die "No se puede abrir el archivo:$!"; while($line=){ chomp($line); if ($line =~ /NetBIOS\ name\ :\ <\/td>/){ print "Name:\t"; print $',"\n"; } } close(H) How do you see I try t

Re: next in foreach loop

2010-08-12 Thread Chas. Owens
On Aug 12, 2010, at 19:08, Kryten wrote: > Hi, > > Complete newbie. > > Is there any way to use "next" from within a foreach loop? > > All the examples I have seen/read use a while loop to demo. Yes, next will work on for/foreach, while, and until loops. So yo

Re: next in foreach loop

2010-08-12 Thread Jeff Pang
2010/8/13 Kryten : > Hi, > > Complete newbie. > > Is there any way to use "next" from within a foreach loop? > Sure. $ perl -le ' > for (1..10) { > next if $_ == 5; > print; > } ' 1 2 3 4 6 7 8 9 10 -- Jeff Pang http://home.arco

next in foreach loop

2010-08-12 Thread Kryten
Hi, Complete newbie. Is there any way to use "next" from within a foreach loop? All the examples I have seen/read use a while loop to demo. Thanks, Stuart -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: How to find the status, i.e. "next run time" and "last run time", of a task which is run through windows task scheduler !

2010-06-09 Thread C.DeRykus
On Jun 8, 2:18 am, learn.tech...@gmail.com (Amit Saxena) wrote: > Hi all, > > I want to know how to find the status, i.e. "next run time" and "last run > time", of a task which is run through windows task scheduler. > > This is required so as to find o

Re: How to find the status, i.e. "next run time" and "last run time", of a task which is run through windows task scheduler !

2010-06-08 Thread Chas. Owens
On Tue, Jun 8, 2010 at 05:18, Amit Saxena wrote: > Hi all, > > I want to know how to find the status, i.e. "next run time" and "last run > time", of a task which is run through windows task scheduler. > > This is required so as to find out instances where a

How to find the status, i.e. "next run time" and "last run time", of a task which is run through windows task scheduler !

2010-06-08 Thread Amit Saxena
Hi all, I want to know how to find the status, i.e. "next run time" and "last run time", of a task which is run through windows task scheduler. This is required so as to find out instances where a task gets "hanged" after run through windows task scheduler. Thanks & Regards, Amit Saxena

Re: eval and next

2009-10-07 Thread Jenda Krynicky
Date sent: Tue, 06 Oct 2009 15:45:44 +0200 From: Alexander Koenig To: beginners Subject:eval and next > Hi all, > > I have a Perl program where I use eval to catch errors. As they are Java > errors (via Inline::Jav

eval and next

2009-10-06 Thread Alexander Koenig
Hi all, I have a Perl program where I use eval to catch errors. As they are Java errors (via Inline::Java) I want my program to continue and just log the errors somewhere. My problem with this is, that I use the eval within a loop and I also use next in this loop to ignore some special cases

Re: how to copy elements into the next array

2009-01-29 Thread Mr. Shawn H. Corey
On Thu, 2009-01-29 at 14:39 +0800, itshardtogetone wrote: > Hi, > How do I copy the first 10 elements of @a into @b? > > The method that I use is long :- > my @a = 1..20; > my @b = (); > > my $ctr = 0; > foreach (@a){ > if ($ctr < 10){ > push @b,$_; > } > $ctr ++; > } See

Re: how to copy elements into the next array

2009-01-28 Thread John W. Krahn
itshardtogetone wrote: Hi, Hello, How do I copy the first 10 elements of @a into @b? my @b = @a[ 0 .. 9 ]; John -- Those people who think they know everything are a great annoyance to those of us who do.-- Isaac Asimov -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For

回复:how to copy elements into the next array

2009-01-28 Thread yantao
try this, @b[0..9] = @a[0..9]; - 原邮件 - 从: itshardtogetone 日期: 星期四, 一月 29日, 2009 下午2:39 主题: how to copy elements into the next array > Hi, > How do I copy the first 10 elements of @a into @b? > > The method that I use is long :- > my @a = 1..20; > my @b = ()

how to copy elements into the next array

2009-01-28 Thread itshardtogetone
Hi, How do I copy the first 10 elements of @a into @b? The method that I use is long :- my @a = 1..20; my @b = (); my $ctr = 0; foreach (@a){ if ($ctr < 10){ push @b,$_; } $ctr ++; } Thanks.

Re: how to round off a decimal to the next whole number

2008-08-08 Thread Dr.Ruud
[EMAIL PROTECTED] schreef: > How do I round off a decimal to the next nearest whole digit , > example > 0.123 = 1, > 1.23 = 2, > 4.7312 = 5, etc etc. Define "next". You can use POSIX::ceil(), but then -1.23 becomes -1 and you might want -2 there? $ echo

Re: how to round off a decimal to the next whole number

2008-08-06 Thread Rob Dixon
[EMAIL PROTECTED] wrote: > > How do I round off a decimal to the next nearest whole digit , > example > 0.123 = 1, > 1.23 = 2, > 4.7312 = 5, etc etc. > > Right now I can only do the above by extracting the first digit using splice > , then add one. You need t

Re: how to round off a decimal to the next whole number

2008-08-06 Thread Jeff Pang
[EMAIL PROTECTED] 写道: > Hi, > How do I round off a decimal to the next nearest whole digit , > example > 0.123 = 1, > 1.23 = 2, > 4.7312 = 5, etc etc. $number = int($number) + 1; also does the same thing. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comman

Re: how to round off a decimal to the next whole number

2008-08-06 Thread Mr. Shawn H. Corey
On Wed, 2008-08-06 at 13:31 +0800, [EMAIL PROTECTED] wrote: > Hi, > How do I round off a decimal to the next nearest whole digit , > example > 0.123 = 1, > 1.23 = 2, > 4.7312 = 5, etc etc. > > Right now I can only do the above by extracting the first digit using

RE: how to round off a decimal to the next whole number

2008-08-06 Thread Stewart Anderson
> -Original Message- > From: Anirban Adhikary [mailto:[EMAIL PROTECTED] > Sent: 06 August 2008 06:51 > To: beginners@perl.org > Subject: Re: how to round off a decimal to the next whole number > > On Wed, Aug 6, 2008 at 11:01 AM, <[EMAIL PROTECTED]> wrote: &g

Re: how to round off a decimal to the next whole number

2008-08-05 Thread Anirban Adhikary
On Wed, Aug 6, 2008 at 11:01 AM, <[EMAIL PROTECTED]> wrote: > Hi, > How do I round off a decimal to the next nearest whole digit , > example > 0.123 = 1, > 1.23 = 2, > 4.7312 = 5, etc etc. > > Right now I can only do the above by extracting the first digit

how to round off a decimal to the next whole number

2008-08-05 Thread itshardtogetone
Hi, How do I round off a decimal to the next nearest whole digit , example 0.123 = 1, 1.23 = 2, 4.7312 = 5, etc etc. Right now I can only do the above by extracting the first digit using splice , then add one. Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands

Re: $topIter->next()

2008-03-27 Thread Gunnar Hjalmarsson
Just posted to clpmisc: Original Message Subject: Re: Operator ->() Date: Thu, 27 Mar 2008 20:35:27 +0100 From: Gunnar Hjalmarsson <[EMAIL PROTECTED]> Newsgroups: comp.lang.perl.misc Subra wrote: [ exactly the same question as was posted to the beginners list a few minutes ear

Re: $topIter->next()

2008-03-27 Thread Jenda Krynicky
From: Subra <[EMAIL PROTECTED]> > Can some one pls tell me wts the meaning of "$topIter->next()" ? > I know "->" is used for hash refs, but dont know when to use ->( ) !!! -> is used for any references. And for method calls. In this case you are call

$topIter->next()

2008-03-27 Thread Subra
Can some one pls tell me wts the meaning of "$topIter->next()" ? I know "->" is used for hash refs, but dont know when to use ->( ) !!! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Reading the next line in a file from the current position

2007-11-12 Thread Praveena Vittal
Thanks for all your comments. Jeff Pang wrote, On 11/12/2007 12:26 PM: On Nov 12, 2007 2:48 PM, Praveena Vittal <[EMAIL PROTECTED]> wrote: Hi, Thanks for your comments.. I like to know what does the below represents.. $' from `perldoc perlvar': $' The string followin

Re: Reading the next line in a file from the current position

2007-11-12 Thread Gunnar Hjalmarsson
Praveena Vittal wrote: I like to know what does the below represents.. $' Then why don't you look it up in the docs instead of asking hundreds of people to read the docs for you? -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTE

Re: Reading the next line in a file from the current position

2007-11-11 Thread Jeff Pang
On Nov 12, 2007 2:48 PM, Praveena Vittal <[EMAIL PROTECTED]> wrote: > Hi, > Thanks for your comments.. > > I like to know what does the below represents.. > > $' > from `perldoc perlvar': $' The string following whatever was matched by the last success- ful pattern m

Re: Reading the next line in a file from the current position

2007-11-11 Thread Praveena Vittal
Hi, Thanks for your comments.. I like to know what does the below represents.. $' Regards, Praveena Jeff Pang wrote, On 11/07/2007 06:48 PM: --- Praveena Vittal <[EMAIL PROTECTED]> wrote: Hi all, I like to know how can we read a line next to the current position

Re: Reading the next line in a file from the current position

2007-11-07 Thread Jeff Pang
--- Praveena Vittal <[EMAIL PROTECTED]> wrote: > Hi all, > > I like to know how can we read a line next to the current position in > a file . > Hi, in scalar context will read next line.ie, open FD,"file" or die $!; for (1..3); # now you're in No

Reading the next line in a file from the current position

2007-11-07 Thread Praveena Vittal
Hi all, I like to know how can we read a line next to the current position in a file . Regards, Praveena -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: peek next line in file

2007-09-27 Thread Xavier Noria
On Sep 27, 2007, at 1:29 AM, Mahurshi Akilla wrote: Is there a way in perl to peek the next line in the file while keeping the line pointer the same? I want to do something like this: while () { //do some stuff //?? peek next line ?? and enter conditional block// //do some more

peek next line in file

2007-09-27 Thread Mahurshi Akilla
Is there a way in perl to peek the next line in the file while keeping the line pointer the same? I want to do something like this: while () { //do some stuff //?? peek next line ?? and enter conditional block// //do some more stuff } Of course, there are workarounds, but it

Re: Help with WWW::Mechanize - Next Question

2006-12-05 Thread Mathew Snyder
ess on any incoming email received by Request Tracker is >> automatically turned into a user account. With the amount of spam >> flying around >> the the Net these days those user accounts add up. >> >> All those spam tickets are assigned to me so I can eliminate them

Re: Help with WWW::Mechanize - Next Question

2006-12-03 Thread Mathew
ess on any incoming email received by Request Tracker is >> automatically turned into a user account. With the amount of spam >> flying around >> the the Net these days those user accounts add up. >> >> All those spam tickets are assigned to me so I can eliminate them

Re: Help with WWW::Mechanize - Next Question

2006-12-03 Thread Rob Dixon
ys those user accounts add up. All those spam tickets are assigned to me so I can eliminate them and the users created as a result of them from our database. My goal is to parse $data to pull out all the email addresses which I will then sift through to remove any legitimate addresses. You'l

Help with WWW::Mechanize - Next Question

2006-12-02 Thread Mathew Snyder
add up. All those spam tickets are assigned to me so I can eliminate them and the users created as a result of them from our database. My goal is to parse $data to pull out all the email addresses which I will then sift through to remove any legitimate addresses. You'll notice I declare the u

Next

2006-07-06 Thread Geetha Weerasooriya
Dear All, Thank you so much for sending me the solution to my problem. It was the first problem I asked and I am really happy I got very well explained answers. I understood it well. Thanks again for every one who take time to answer my question. Kind regards, Geetha

Re: Next

2006-07-06 Thread Xavier Noria
On Jul 6, 2006, at 6:26, Geetha Weerasooriya wrote: Dear all, When I was reading a Perl code I found the following line. Can u please explain what it means? !defined($rt_nearest) or $dh<$dist or next; It means next unless !defined($rt_nearest) or $dh < $dist; or, equiva

Re: Next

2006-07-06 Thread marcos rebelo
basically code done by a hacker, not a software developer if I'm correct this shall mine if (not( ! defined($rt_nearest) or $dh<$dist)) { next; } On 7/6/06, Geetha Weerasooriya <[EMAIL PROTECTED]> wrote: Dear all, When I was reading a Perl code I found the following line

Re: Next

2006-07-06 Thread Rob Dixon
Geetha Weerasooriya wrote: > > Dear all, > > When I was reading a Perl code I found the following line. Can u > please explain what it means? > > !defined($rt_nearest) or $dh<$dist or next; Hi Geetha Oh dear, it's not very readable is it! I assume you know what

Next

2006-07-05 Thread Geetha Weerasooriya
Dear all, When I was reading a Perl code I found the following line. Can u please explain what it means? !defined($rt_nearest) or $dh<$dist or next; Kind regards, Geetha

How to handle "\" indicating next line

2005-12-27 Thread Khairul Azmi
Hi all, I am writing a code that would check line by line content of a line before processing it. Problem occurs when there are lines that has character "\" indicating a new line. For example preprocessor http_inspect: global \ iis_unicode_map unicode.map 1252 When that happen, my code should

RE: variable declaration, was RE: moving to the next line

2004-12-17 Thread Charles K. Clarkson
Chris Devers <[EMAIL PROTECTED]> wrote: : On Thu, 16 Dec 2004, Charles K. Clarkson wrote: : : : Don't declare all your variables at the beginning : : of the script. It works in other languages, but not : : in perl. Declare them as you go. : : Out of curiosity, why this rule? : : When taking

Re: variable declaration, was RE: moving to the next line

2004-12-17 Thread Chris Devers
On Fri, 17 Dec 2004, Paul Johnson wrote: > On Fri, Dec 17, 2004 at 09:17:05AM -0500, Chris Devers wrote: > > > On Thu, 16 Dec 2004, Charles K. Clarkson wrote: > > > > > Don't declare all your variables at the beginning > > > of the script. It works in other languages, but not > > > in perl.

Re: variable declaration, was RE: moving to the next line

2004-12-17 Thread Paul Johnson
Sorry, I sent the last reply before I had finished it. On Fri, Dec 17, 2004 at 09:17:05AM -0500, Chris Devers wrote: > On Thu, 16 Dec 2004, Charles K. Clarkson wrote: > > > Don't declare all your variables at the beginning > > of the script. It works in other languages, but not > > in perl.

Re: variable declaration, was RE: moving to the next line

2004-12-17 Thread Lawrence Statton
> Out of curiosity, why this rule? > > When taking programming classes in college, it was drummed into us that > having a data dictionary at the top of a scope was a good habit, and > it's something that I've generally done with the Perl I've written. > > Several people on this list have disc

Re: variable declaration, was RE: moving to the next line

2004-12-17 Thread Chris Devers
On Fri, 17 Dec 2004, Jonathan Paton wrote: > On Fri, 17 Dec 2004 09:17:05 -0500 (EST), Chris Devers wrote: > > And what programming language were you learning? C/C++, Java, Visual Basic, Cobol. > In some other languages, like C, C++ and Java you must specify the > exact type of each variable.

Re: variable declaration, was RE: moving to the next line

2004-12-17 Thread Paul Johnson
On Fri, Dec 17, 2004 at 09:17:05AM -0500, Chris Devers wrote: > On Thu, 16 Dec 2004, Charles K. Clarkson wrote: > > > Don't declare all your variables at the beginning > > of the script. It works in other languages, but not > > in perl. Declare them as you go. I suppose that depends on your

Re: variable declaration, was RE: moving to the next line

2004-12-17 Thread Jonathan Paton
On Fri, 17 Dec 2004 09:17:05 -0500 (EST), Chris Devers <[EMAIL PROTECTED]> wrote: > On Thu, 16 Dec 2004, Charles K. Clarkson wrote: > > > Don't declare all your variables at the beginning > > of the script. It works in other languages, but not > > in perl. Declare them as you go. > > Out of c

variable declaration, was RE: moving to the next line

2004-12-17 Thread Chris Devers
On Thu, 16 Dec 2004, Charles K. Clarkson wrote: > Don't declare all your variables at the beginning > of the script. It works in other languages, but not > in perl. Declare them as you go. Out of curiosity, why this rule? When taking programming classes in college, it was drummed into us th

RE: moving to the next line

2004-12-15 Thread Charles K. Clarkson
you go. : LOOKING_LINES: while(@line = `cat clicenses_output`){ Stop using line labels. They work in perl, but they are rarely needed. [snip] : This is the line giving me issues: : : LOOKING_HANDLES: while (@line = `cat : clicenses_output`); : : Basically, after I grab $feature I need to mo

moving to the next line

2004-12-15 Thread Christopher Spears
es; my $features; my $sizeof; my $counter = 0; my $answer; my $string; LOOKING_LINES: while(@line = `cat clicenses_output`){ foreach $line(@line){ next unless $line =~ /\S/; $line =~ s/^\s+//; @features_array = split /\s/, $line;#split $line

Re: finding Makefiles which containing a backslash continuation character where the next line is blank or whitespace

2004-08-04 Thread Ken Wolcott
John; Thank you very much for the help...works like a charm...now I'll try to study it carefully to understand how to use this the next time I need something like this... Cool... Ken Wolcott On Tue, 2004-08-03 at 20:20, John W. Krahn wrote: > Ken Wolcott wrote: > > Hi; > &g

Multiple Page Web-forms, without passing earlier pages values to the next one?

2004-08-04 Thread Sanjay Arora
I am using RH9, postgreSQL and perl5. Is it possible to get users to submit multiple page web-forms but not to pass values from one form to the next? I would like to store each page to the database server as it is submitted. Also, to build in the process to resume the web-form submission at a

Re: finding Makefiles which containing a backslash continuation character where the next line is blank or whitespace

2004-08-03 Thread John W. Krahn
Ken Wolcott wrote: Hi; Hello, I need to find Makefiles that contain a backslash line continuation character followed by a blank (or whitespace only) line. I tried a regular expression first but just couldn't get it right. I then tried comparing by a pair of strings, but that isn't right either.

finding Makefiles which containing a backslash continuation character where the next line is blank or whitespace

2004-08-03 Thread Ken Wolcott
Hi; I need to find Makefiles that contain a backslash line continuation character followed by a blank (or whitespace only) line. I tried a regular expression first but just couldn't get it right. I then tried comparing by a pair of strings, but that isn't right either. First try:

Re: next if question

2004-04-22 Thread Jeff 'japhy' Pinyan
On Apr 22, rmck said: >bash-2.03$ ./clean.pl data.txt >10 >5201 >8001 >0 >3802 >##The Rest## >Header >20 >80 >bash-2.03$ > >I thought I could do this: > >#!/bin/perl > use strict; > use warnings; > > while( <> ) { #read fr

Re: next if question

2004-04-22 Thread rmck
Both of these work great (thanks): next if $_ =~ /(^20$|^80$|^Header$)/; next if m/^(?:Header|[28]0)$/; So now my results are: bash-2.03$ ./clean.pl data.txt 10 5201 8001 0 3802 bash-2.03$ How can you have the parsed info printed? Can you still use the $_?? So the goal would be: bash-2.03

Re: next if question

2004-04-22 Thread James Edward Gray II
On Apr 22, 2004, at 8:54 AM, rmck wrote: hi, I have a while statement that does a next if a match is made against a reg exprerssion of some numbers. data file: Header 10 20 5201 8001 0 80 3802 #!/bin/perl use strict; use warnings; while( <> ) { #read from

next if question

2004-04-22 Thread rmck
hi, I have a while statement that does a next if a match is made against a reg exprerssion of some numbers. data file: Header 10 20 5201 8001 0 80 3802 #!/bin/perl use strict; use warnings; while( <> ) { #read from stdin one line or record at a time

Re: more on warn .. is next necessary

2004-03-31 Thread Jenda Krynicky
From: Harry Putnam <[EMAIL PROTECTED]> > I wasn't able to really understand perldoc -f warn. > > I'm doing > use File::Find; > open(FILE,"<$File::Find::name")or warn "blah blah: $!"; > > Two things I'm unsure of: > > 1) is

Re: `next LABEL' usage

2004-03-29 Thread R. Joseph Newton
Harry Putnam wrote: > "Charles K. Clarkson" <[EMAIL PROTECTED]> writes: > > > HTH, > > Definitely and thanks for the examples. I think I was making this > more complicated that it needed to be. It's slowly sinking in what > all a `return' can do. Hi Harry, Glad Charles got you squared away. I

Re: more on warn .. is next necessary

2004-03-29 Thread Harry Putnam
"Wiggins d'Anconia" <[EMAIL PROTECTED]> writes: [...] > if you don't mind dieing, or I often prefer using 'unless' then I > don't need to worry about a dangling else, so similar to what you have > above, In this case I do. > > unless (open(FILE, "<$file")) { >warn "Failed open: $!"; >re

Re: more on warn .. is next necessary

2004-03-29 Thread Wiggins d'Anconia
Harry Putnam wrote: "John W. Krahn" <[EMAIL PROTECTED]> writes: If so, how do I let the `next' know that open has failed? That is, how do I test exit status of open function? open() returns true on success and undef (false) when it fails. Is it just as in shell programing

Re: `next LABEL' usage

2004-03-29 Thread Harry Putnam
"Charles K. Clarkson" <[EMAIL PROTECTED]> writes: > HTH, Definitely and thanks for the examples. I think I was making this more complicated that it needed to be. It's slowly sinking in what all a `return' can do. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [E

Re: more on warn .. is next necessary

2004-03-29 Thread Harry Putnam
"John W. Krahn" <[EMAIL PROTECTED]> writes: >> If so, how do I let the `next' know that open has failed? >> That is, how do I test exit status of open function? > > open() returns true on success and undef (false) when it fails. > > >> Is it jus

Re: more on warn .. is next necessary

2004-03-29 Thread John W. Krahn
Harry Putnam wrote: > > I wasn't able to really understand perldoc -f warn. > > I'm doing > use File::Find; > open(FILE,"<$File::Find::name")or warn "blah blah: $!"; > > Two things I'm unsure of: > > 1) is the `: $!' m

RE: `next LABEL' usage

2004-03-29 Thread Charles K. Clarkson
t.. or : does one need to exit from the current file being offered : by `sub find()' : : > : So using the `next LABEL' technique how do I : > : designate the wanted() subroutine as target? : > : Something like this: : > : : > : sub LABEL: wanted { : > : > I have

Re: `next LABEL' usage

2004-03-29 Thread Harry Putnam
fered by `sub find()' > : So using the `next LABEL' technique how do I > : designate the wanted() subroutine as target? > : Something like this: > : > : sub LABEL: wanted { > > I haven't tested it, but I would think this would fail. > > : open(FIL

RE: `next LABEL' usage

2004-03-29 Thread Charles K. Clarkson
Harry Putnam <[EMAIL PROTECTED]> wrote: : : I'm using a next LABEL inside a File::Find : sub wanted {...} loop : : It is further buried in a while loop inside the : `sub wanted()' : : The while loop is while () on the most recent : found file. I want this `next LABEL' to

`next LABEL' usage

2004-03-29 Thread Harry Putnam
I'm using a next LABEL inside a File::Find sub wanted {...} loop It is further buried in a while loop inside the `sub wanted()' The while loop is while () on the most recent found file. I want this `next LABEL' to bring on a new file... not a new line in while loop. So using

more on warn .. is next necessary

2004-03-29 Thread Harry Putnam
I wasn't able to really understand perldoc -f warn. I'm doing use File::Find; open(FILE,"<$File::Find::name")or warn "blah blah: $!"; Two things I'm unsure of: 1) is the `: $!' meaningfull here? 2) do I need a `next;' following to make `File::Find

Re: output on stderr from `next'

2004-03-29 Thread Randy W. Sims
Harry Putnam wrote: I'm getting this output on stderr from a next clause: Exiting subroutine via next at ./test_bol.pl line 101. I wondered why this happens. Is it considered an error or what? The script is lengthy so not posting it here but the next does exit a sub routine. That is why

Re: output on stderr from `next'

2004-03-27 Thread Harry Putnam
"Randy W. Sims" <[EMAIL PROTECTED]> writes: > Use 'return' to exit from a subroutine. Use 'next', 'redo', 'last', > and 'goto' to alter the execution path in loop constructs; they must > appear /inside/ the block owned by

Re: output on stderr from `next'

2004-03-27 Thread Paul Johnson
On Sat, Mar 27, 2004 at 03:24:13PM -0500, Randy W. Sims wrote: > Harry Putnam wrote: > >I'm getting this output on stderr from a next clause: > > Exiting subroutine via next at ./test_bol.pl line 101. > > > >I wondered why this happens. Is it considered an err

Re: output on stderr from `next'

2004-03-27 Thread Randy W. Sims
Harry Putnam wrote: I'm getting this output on stderr from a next clause: Exiting subroutine via next at ./test_bol.pl line 101. I wondered why this happens. Is it considered an error or what? The script is lengthy so not posting it here but the next does exit a sub routine. That is why

output on stderr from `next'

2004-03-27 Thread Harry Putnam
I'm getting this output on stderr from a next clause: Exiting subroutine via next at ./test_bol.pl line 101. I wondered why this happens. Is it considered an error or what? The script is lengthy so not posting it here but the next does exit a sub routine. That is why I put it there. S

Re: is next implied in a set of if elsifs?

2003-10-20 Thread Steve Grazzini
On Sun, Oct 19, 2003 at 08:02:34PM -0700, R. Joseph Newton wrote: > I think your formatting may reflect a misconception about if and > elsif staements. > > while ($foo) { > if ($condition_1) { > do_1(); > } > elsif ($condition_2) { > do_2(); > } > # ... > } > > Should be: Wait a m

Re: is next implied in a set of if elsifs?

2003-10-19 Thread R. Joseph Newton
Dan Anderson wrote: > > But what's the speed concerns here? This is negligable. > > I just double checked and each if statement takes roughly 9.8 > microseconds more to execute then an elsif. That may not seem like a > lot but over a program spanning several files (perhaps as much as a meg > in

Re: is next implied in a set of if elsifs?

2003-10-15 Thread Tore Aursand
On Wed, 15 Oct 2003 17:34:33 -0400, Dan Anderson wrote: > How is speed affected in the following scenarios: > [...] Why don't you find out? Take a look at the Benchmark module. There is also a 'SWITCH' module out there, I think. You might look at that one, too. -- Tore Aursand <[EMAIL PROTEC

Re: is next implied in a set of if elsifs?

2003-10-15 Thread James Edward Gray II
On Wednesday, October 15, 2003, at 07:30 PM, Dan Anderson wrote: Now this is not actually reflective of the code in my program. I just needed a clean, controlled environment to compare different things. Do you have a large if/else decision tree? We might be able to provides some ideas there if

  1   2   >