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 = STDIN){ chomp ($line); $hash{L_c_start}++ if ($line =~ /^C.*/i); @words = split /\s+/,$line; foreach $c (keys @words){ print word $words[$c]\n;

Re: loop does select next line

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

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 it

Re: Next subnet

2013-05-27 Thread shawn wilson
On May 27, 2013 1:02 PM, Dr.Ruud rvtol+use...@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\.\/]+% } @{$opts-{ip}} or scalar(@{$opts-{ip}}) 1 The '+' in the regexp is

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 rvtol+use...@isolution.nl 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 { !

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 boundry. Having

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 mich...@jamhome.us 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 second time

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 . ]\n; print start mask [ . $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 [ . $ip-prefixlen . ]\n; $ip-set($ip-last_ip); $ip

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, Vyacheslav

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-08 Thread Binish A.R
of GNOME border=0 / From: Vyacheslav agapov.sl...@gmail.com To: beginners@perl.org Sent: Sunday, April 8, 2012 11:42 AM Subject: foreach and next Hello all. My english bad and i have a problem. I am connected to databases in a cycle foreach and the script die

Re: foreach and next

2012-04-08 Thread Shlomi Fish
using next): my $dbh = DBI-connect($dsn, $user, $pass); if (!$dbh) { next DB_HOSTS_LOOP; # And label the loop appropriately. } Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ Humanity - Parody

Re: foreach and next

2012-04-08 Thread Vyacheslav
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. } Regards, Shlomi Fish -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands

Re: foreach and next

2012-04-08 Thread Shlomi Fish
Hi Vyacheslav, On Sun, 08 Apr 2012 15:10:06 + Vyacheslav agapov.sl...@gmail.com 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

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

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 statement:

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:

foreach and next

2012-04-07 Thread Vyacheslav
die How I can pass an error that the cycle has continued execute? I need host db1 - ok host db2 - ok host db3 - ok ... host db10 - ok Can I use next operator in this situation? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http

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

2011-11-26 Thread Raito Garcia
=~ /td align\=\left\NetBIOS\ name\ :\ \/td/){ print Name:\t; print $',\n; } } close(H) How do you see I try to print the next line after the REGEX match, but I obtain the next result: Name: Name: Name: Name: Name: I mean, I print nothing :S does anybody

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

2011-11-26 Thread Shlomi Fish
Name:\t; print $',\n; This won't work because $' does not contain the next line - it only contains the rest of the line after the match. If you want to print the next line, you can either do: my $next_line = $html_fh; chomp($next_line); print $next_line

next in foreach loop

2010-08-13 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: next in foreach loop

2010-08-13 Thread Jeff Pang
2010/8/13 Kryten kryte...@googlemail.com: 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.arcor.de/pangj/ -- To unsubscribe, e-mail

Re: next in foreach loop

2010-08-13 Thread Chas. Owens
On Aug 12, 2010, at 19:08, Kryten kryte...@googlemail.com 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 you can say for my

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 out instances where a task gets hanged after run through

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: 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 learn.tech...@gmail.com 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 task gets hanged after

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 `perldoc

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.

回复:how to copy elements into the next array

2009-01-28 Thread yantao
try this, @b[0..9] = @a[0..9]; - 原邮件 - 从: itshardtogetone itshardtoget...@hotmail.com 日期: 星期四, 一月 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

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

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 -1.23 4.1 5 |perl -MPOSIX -nwle'print ceil

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: Hi, How do I round off a decimal

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 splice , then add one. Thanks

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 commands, e-mail: [EMAIL

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 the ceil() function from the POSIX module

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: 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 using splice , then add one. Thanks

$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: $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 calling the next() method of the $topIter object. Jenda

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

Next Page gets downloaded in Perl

2007-12-13 Thread Praki
) this condition as both will be empty. and here i m getting the login information and again i m calling the same file(login.cgi). now as the sumbit value will not be empty it has to go the next condtion elsif ($sid eq $submit_valu ne ) .i m validating the credentials here. but the problem here i face

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

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 following

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 in a file . Hi

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 match

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, FD in scalar context will read next line.ie, open FD,file or die $!; FD for (1..3); # now you're in No.3 line,again we say: scalar FD

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/

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 (INFILE) { //do some stuff //?? peek next line ?? and enter conditional block// //do some more stuff } Of course, there are workarounds

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 (INFILE) { //do some stuff //?? peek next line ?? and enter conditional block// //do

Re: Help with WWW::Mechanize - Next Question

2006-12-05 Thread Mathew Snyder
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 use of HTML::TokeParser. This leads to my next question. Do I need to use that? Would it be simpler to just parse

Re: Help with WWW::Mechanize - Next Question

2006-12-03 Thread Rob Dixon
the email addresses which I will then sift through to remove any legitimate addresses. You'll notice I declare the use of HTML::TokeParser. This leads to my next question. Do I need to use that? Would it be simpler to just parse the data matching against a regex and put any matches into a file? I

Re: Help with WWW::Mechanize - Next Question

2006-12-03 Thread Mathew
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 use of HTML::TokeParser. This leads to my next question. Do I need to use that? Would it be simpler to just parse

Help with WWW::Mechanize - Next Question

2006-12-02 Thread Mathew Snyder
will then sift through to remove any legitimate addresses. You'll notice I declare the use of HTML::TokeParser. This leads to my next question. Do I need to use that? Would it be simpler to just parse the data matching against a regex and put any matches into a file? I imagine I don't need

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' does. If not, look at perldoc -f

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. Can u please

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, equivalently, next

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

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

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 that

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 curiosity,

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

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

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. Declare them

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

moving to the next line

2004-12-15 Thread Christopher Spears
$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 along whitespace

RE: moving to the next line

2004-12-15 Thread Charles K. Clarkson
= `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 move to the : next element of the array

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

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; Hello, I need

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: 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

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

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 stdin one

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 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 from stdin one line or record at a time next if $_ =~ /(^20$|^80$|^Header$)/; print

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 the `: $!' meaningfull here? 2) do I need a `next;' following to make `File::Find' go

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 I put

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' go on to the next found file? If so, how do I let

`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 (FILE) 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 the `next

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 (FILE) on the most recent : found file. I want this `next LABEL' to bring on a : new

Re: `next LABEL' usage

2004-03-29 Thread Harry Putnam
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(FILE,File::Find::name); : while (FILE){ : if(something) { : then do something

RE: `next LABEL' usage

2004-03-29 Thread Charles K. Clarkson
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 haven't tested it, but I would think this would fail. : : : open(FILE,File::Find

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 `: $!' meaningfull here? Yes. 2) do I need a `next;' following to make `File::Find' go

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 just as in shell programing ($?)? No. ok, then how is it done

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: [EMAIL

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 ($?)? No. ok, then how

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: $!; return; } Ah

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 have to

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. So how

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 I put

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 error or what? The script is lengthy so

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 the loop construct or within a sub-block. Ahh, ok thanks. Return turns out

next if statement....

2004-03-18 Thread Greg Schiedler
OK I'm trying to modify the code below to recognize an additional next if statement. I have included a snip of the file that the code uses an input. Greg next if /Acct-Session-Id = /;This statment works! # I added this statement. I don't understand the /'s in the statement

Re: next if statement....

2004-03-18 Thread Christopher G Tantalo
address. So, your line: next if /NAS-IP-Address = 192.168.0.1/; change to next if /NAS-IP-Address = 192.168.0.1/; and it will skip to the next line if that line ever comes up. -- --- Just Your Friendly Neighborhood _SPIDEY_ Greg Schiedler wrote: OK I'm trying

Re: next if statement....

2004-03-18 Thread Paul Archer
12:15pm, Greg Schiedler wrote: OK I'm trying to modify the code below to recognize an additional next if statement. I have included a snip of the file that the code uses an input. Greg next if /Acct-Session-Id = /;This statment works! A 'next if /./' is a short form

RE: next if statement....

2004-03-18 Thread Ed Christian
Paul Archer wrote: 12:15pm, Greg Schiedler wrote: OK I'm trying to modify the code below to recognize an additional next if statement. I have included a snip of the file that the code uses an input. Greg next if /Acct-Session-Id = /;This statment works! A 'next

  1   2   >