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;
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
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
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
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 { !
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
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
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
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
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
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 написал
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
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
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
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
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
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:
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:
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
=~ /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
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
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/
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
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
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
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
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
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
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
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.
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
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
[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
-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
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
[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
[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
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
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
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/
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
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
) 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
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
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
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
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
--- 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
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/
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
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
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
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
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
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
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
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
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
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
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
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
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
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,
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
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.
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
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
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
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
$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
= `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
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
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
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:
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 - 100 of 174 matches
Mail list logo