-Original Message-
From: Greg Schiedler [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 18, 2004 2:16 PM
To: [EMAIL PROTECTED]
Subject: next if statement
OK I'm trying to modify the code below to recognize an additional next if statement.
I have
included a snip of the file
may separate the text from the equal sign on
both sides.
Bill
-Original Message-
From: Greg Schiedler [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 18, 2004 2:16 PM
To: [EMAIL PROTECTED]
Subject: next if statement
OK I'm trying to modify the code below to recognize an additional
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 minute!
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 code
();
}
# ...
}
3) using a series of if elsifs and calling next:
i.e.
while ($foo) {
if ($condition_1) {
do_1();
next;
}
elsif ($condition_2) {
do_2();
next;
}
# ...
}
For readability, I prefer 1 over 2. But I figured 2 would be faster
then 1. For readability I prefer 2
++;
} # $x == 11
2) Using a series of if elsifs
i.e.
while ($foo) {
if ($condition_1) {
do_1();
}
elsif ($condition_2) {
do_2();
}
# ...
}
3) using a series of if elsifs and calling next:
i.e.
while ($foo) {
if ($condition_1) {
do_1();
next
($condition_2) {
do_2();
}
}
while ($foo) {
if ($condition_1) {
do_1();
next;
}
elsif ($condition_2) {
do_2();
next;
}
}
These are, in your case, identical. An if-elsif-else block skips all the
remaining conditionals when it reaches a true one. So you don't need
'next
But what's the speed concerns here? This is negligable.
Well until applied across the entire program. The program I am working
with is significantly longer then the example.
-Dan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
thousands of if statements there is a
huge difference in the amount of time taken, esp. if it's a web program
being used by a number of users simultaneously.
I also triple checked with next statements and I got a really bizarre
result, they were actually slower then just using if elsifs by 17
On Wed, Oct 15, 2003 at 06:25:45PM -0400, Dan Anderson wrote:
But what's the speed concerns here? This is negligable.
Well until applied across the entire program. The program I am working
with is significantly longer then the example.
Just a few random quotes, attached to this message
, Damn Lies and Benchmarks? ;) Careful, here be dragons!
I also triple checked with next statements and I got a really bizarre
result, they were actually slower then just using if elsifs by 17
microseconds. :: shrugs :: I guess it makes sense -- next involves
extra overhead.
Yes, executing a next
2:
elsif ($condition)
{ print TRUE; } # condition is never reached
#test 3:
elsif ($condition)
{ print TRUE; next; } # condition is never reached
Now this is not actually reflective of the code in my program. I just
needed a clean, controlled environment to compare different things.
You both make
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
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
/\|/, $userInfo;
# get rig of the header info from repquota
next if ( ( $name =~ /Block/ ) or ( $name =~ /nobody/ ) or ( $name =~
/User/ ) or ( $name =~ /^\d/ ) or ( $name =~ /www/ ) or ( $name =~ /backup/
) or ( $name =~ /ftp/ ) or ( $name =~ /httpd/ ) or ( $name =~ /root
This should work...
next if $name =~
/Block|nobody|User|www|backup|ftp|httpd|root|netop|sysop|users|bill/;
next if $name =~ /^(?:\d|#)/;
next if $quota !~ /\d+/;
next if $quota = 8;
You should also be able to combine the two (just make sure you test my
syntax)...
next if $name =~
/(?:^(?:\d
of the header info from repquota
I hope you have used 'strict' and 'warnings'? I
haven't seen any declarations!
next if ( ( $name =~ /Block/ ) or ( $name =~ /nobody/ ) or (
$name =~ /User/ ) or ( $name =~ /^\d/ ) or ( $name =~ /www/ ) or (
$name =~ /backup/ ) or ( $name =~ /ftp/ ) or ( $name
the likelihood of error.
next if ( ( $name =~ /Block/ ) or ( $name =~ /nobody/ ) or ( $name =~
/User/ ) or ( $name =~ /^\d/ ) or ( $name =~ /www/ ) or ( $name =~ /backup/
) or ( $name =~ /ftp/ ) or ( $name =~ /httpd/ ) or ( $name =~ /root/ ) or (
$name =~ /netop/ ) or ( $name =~ /sysop
You need to use Javascript.
a href=javascript:history.back()Back/a
Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]
- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 13, 2003 10:42 AM
Subject: Previous and Next
Hi List,
How
that, how in the world are they going to click on
a link that could do the same thing?
The biggest problem here is in the original question:
Octavian How can i write a PERL Script to simulate the Previous (-) and Next (-)
Octavian Links
Octavian (like in IE or Netscape).
As in, what could
Joshua Kaufman wrote:
Bob -
Thanks, I'll investigate that.
I'm also hoping that the list will tell me how to do it by incrementing
the proper special variable. I could swear that I've done that before, and
have found it useful in other contexts.
-- Josh
The $. variable won't do
an alternative:
$print, /- Student Id|$/ for LOG;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hi All;
I'm trying to match a pattern in a text file and then print out the next
line in that file. I could swear that I've done this before by incrementing
$. to move to the next line. However, the code below is printing out the
matched line rather than the next line.
#!/usr/bin/perl
open
You could always say LOG again inside your if to print the next line.
Realize that you will not then be able to check that line for the
string, but if that is ok which it sounds like it is then it should
work. See below.
Joshua Kaufman wrote:
Hi All;
I'm trying to match a pattern in a text
your if to print the next line.
Realize that you will not then be able to check that line for the
string, but if that is ok which it sounds like it is then it should
work. See below.
Joshua Kaufman wrote:
Hi All;
I'm trying to match a pattern in a text file and then print out the next
;-)
Altering $. has no effect on the position of a filehandle.
On 11/23/02 8:44 AM, Wiggins d'Anconia [EMAIL PROTECTED] wrote:
You could always say LOG again inside your if to print the next line.
Realize that you will not then be able to check that line for the
string, but if that is ok
that I'm not crazy and have done it
this way before.
I'm sorry to report that you may be crazy ;-)
Altering $. has no effect on the position of a filehandle.
On 11/23/02 8:44 AM, Wiggins d'Anconia [EMAIL PROTECTED] wrote:
You could always say LOG again inside your if to print the next
.
I'm sorry to report that you may be crazy ;-)
Altering $. has no effect on the position of a filehandle.
On 11/23/02 8:44 AM, Wiggins d'Anconia [EMAIL PROTECTED] wrote:
You could always say LOG again inside your if to print the next line.
Realize that you will not then be able to check
Joshua Kaufman wrote:
Hi All;
Hello,
I'm trying to match a pattern in a text file and then print out the next
line in that file. I could swear that I've done this before by incrementing
$. to move to the next line. However, the code below is printing out the
matched line rather than
I am working on a User Search Page that uses Net Daemon to connect to
another system and gather username information. Everything appears to be
working fine except the user search next results option (Code included
below).
Basically the program goes out connects to a daemon on another system
I am working on a User Search Page that uses Net Daemon to connect to
another system and gather username information. Everything appears to be
working fine except the user search next results option (Code included
below).
Basically the program goes out connects to a daemon on another system
Darryl Schnell wrote at Thu, 19 Sep 2002 16:09:06 +0200:
The problem is it's giving me a illegal division by zero error for the
following line:
if ($result_count !=0) {
$pagecount = int($result_count / $limit);
^^
Seems like $limit is 0 :-)
George Schlossnagle [EMAIL PROTECTED] writes:
I think you need to stop programming C. :)
'last' is the token you want to use for breaking out of a loop in perl.
In the script I posted `last' used in place of next, doesn't work
like I wanted. It just stops the script on the first file
-Original Message-
From: Harry Putnam [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 10:25 PM
To: [EMAIL PROTECTED]
Subject: go to next file
I know its possible to force perl to read the next file but have
forgotten how to do it.
The simple script below
Dharmender Rai [EMAIL PROTECTED] writes:
you are not reading the files properly.
use 2 while loops. the outer for traversing the
command line args while the inner for reading and
checking the file contents. use break in the inner
while loop when you get a blank line to go to the
outer
ARGV;' right here.
next;
}
}
Yup, that did it and its majorly faster than using the two while
loops as suggested.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Harry Putnam wrote:
#!/usr/local/bin/perl -w
$regex = shift;
while(){
$cnt++;
if($cnt == 1){
print $ARGV\n;
}
if(/$regex/){
printf %-3d %s, $cnt, $_;
}elsif(/^$/){
$cnt = 0;
next;
}
}
you are feeding reg directly
;
## IMPORTANT (From Bob Showalter on perl beginner list
## If we don't close ARGV here we just skip to next blank line
## not next file.
close(ARGV);
next;
}
}
print $tcnt\n;
sub usage{
print EOM;
Purpose: scan and print individual mail headers or all mail headers
Usage: \`$myscript 'REGEX
Harry Putnam wrote:
Excuse my skull bone density... not sure I follow this. Not sure I
see how `chop' does anything to `\'
[...]
assume your program is named scan.pl, what happen is you call it:
scan.pl '\'
your script always assume user will be entering a valid reg to use. i am
david [EMAIL PROTECTED] writes:
Harry Putnam wrote:
Excuse my skull bone density... not sure I follow this. Not sure I
see how `chop' does anything to `\'
[...]
assume your program is named scan.pl, what happen is you call it:
scan.pl '\'
It will wait for input since files are
Harry Putnam wrote:
david [EMAIL PROTECTED] writes:
Won't is still quite even with the eval, in the above case?
passing it to Perl
Can you give an example of this?
no it doesn't. if you put it inside an eval{}, it won't quit. consider:
#!/usr/bin/perl -w
use strict;
my $reg = shift;
david [EMAIL PROTECTED] writes:
Harry Putnam wrote:
david [EMAIL PROTECTED] writes:
Won't is still quite even with the eval, in the above case?
passing it to Perl
Can you give an example of this?
no it doesn't. if you put it inside an eval{}, it won't quit. consider:
Harry Putnam wrote:
david [EMAIL PROTECTED] writes:
Harry Putnam wrote:
david [EMAIL PROTECTED] writes:
Won't is still quite even with the eval, in the above case?
passing it to Perl
Can you give an example of this?
no it doesn't. if you put it inside an eval{}, it won't quit.
On Thu, Sep 12, 2002 at 05:04:20PM -0700, Harry Putnam wrote:
david [EMAIL PROTECTED] writes:
I must be a real dunce, but I still don't get the point.
If a bad regex is given, I want the program to stop.
Your script above doesn't spit an error, it just fails and gives some
other error.
I know its possible to force perl to read the next file but have
forgotten how to do it.
The simple script below is supposed to read message files that are on
disk one message per file.
I want to go to the next file when the first blank line is seen.
I don't see how $cnt can equal one more than
PROTECTED] wrote: I know
its possible to force perl to read the next
file but have
forgotten how to do it.
The simple script below is supposed to read message
files that are on
disk one message per file.
I want to go to the next file when the first blank
line is seen.
I don't see how $cnt
use break in the inner
while loop when you get a blank line to go to the
outer while loop.
I think you need to stop programming C. :)
'last' is the token you want to use for breaking out of a loop in perl.
George
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
Hi David,
While I raise quite a few issues here, I have to say that I've rarely seen
anyone present a CGI.pm alternative that supports uploads. I'm quite
impressed, so keep that in mind while I pick it apart :)
I'll ignore anything I may have covered in my discussion about the previous
/) # Compare this line w/next line
{
next; # If it matches, skip it
}
else {
print Address = $sorted[$i] \n;
}
}
Scot Robnett
inSite Internet Solutions
[EMAIL PROTECTED]
[EMAIL PROTECTED]
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http
if ($sorted[$i] =~ /$j/) # Compare this line w/next line
{
next; # If it matches, skip it
}
else {
print Address = $sorted[$i] \n;
}
}
Tagore Smith
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
BTW, one thing you might consider is that there may be duplicate email
addresses that differ only in case. You might want to check for that.
Tagore Smith
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
PROTECTED]
[EMAIL PROTECTED]
-Original Message-
From: Tagore Smith [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 22, 2002 1:16 PM
To: cgi
Subject: Re: How to match next line?
BTW, one thing you might consider is that there may be duplicate email
addresses that differ only in case. You might
Hello All,
Is it possible to parse form data from one CGI script to another one.
What I want to do is have a user login to a page. From their I the user
to select on a link then that link will take them to another CGI
script. In this new CGI script I need that to contain some information
of
Hey all,
For any one that cares... :)
I simply told the hyperlink/submit button to point to the new CGI script
and parse on the data I wanted it to like so...
/cgi-bin/newcgi.cgi?data=$data
Very very easy!
Cheers,
Dan
On Tue, 2002-04-09 at 10:52, Daniel Falkenberg wrote:
Hello All,
Is
Daniel Falkenberg wrote:
Hello All,
Is it possible to parse form data from one CGI script to another one.
What I want to do is have a user login to a page. From their I the user
to select on a link then that link will take them to another CGI
script. In this new CGI script I need that
G'day all,
Just wondering if some one can help me with the folloing problem...?
Basically I have a variable that will change at regular intervals. The
varible may look like this...
$var = Crud Crud Call Distance: UNfasdfasdfasdfasdfasdn alternative.
(fasdfsda) SuperZone region: Gawler Call
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] (Randal L. Schwartz) wrote:
One of my very first WT columns...
http://www.stonehenge.com/merlyn/WebTechniques/col02.html
.. too bad I've already written my *last* WT column, to appear
in Feb 2002, because the magazine is terminating. :(
From: [EMAIL PROTECTED]
This is a question for Perl programmers in the field.
I would like to hear your advice in my next step.
I work presently in a DOS - windows environment. I program
Perl in DOS. It is pretty straight Perl scripts.
Besides some DBI, and a sprinkle
I am working on a program that will read the password file and display a
list of users that match the gid's 670 671 on an html page.
I have that part worked out, however now I want to have the results
display in groups of ten allowing the user to click on next results to
see the next results
I am working on a program that will read the password file and display a
list of users that match the gid's 670 671 on an html page.
I have that part worked out, however now I want to have the results
display in groups of ten allowing the user to click on next results to
see the next results
Hi All,
I am trying to find the date, month and year of the next Monday given any
day.
I am using this to get todays date/day/month etc. Is there a way to use
this
information to get the next Monday?
#snip-start
$thisday=(Sun,Mon,Tue,Wed,Thu,Fri,Sat)[(localtime)[6]];
$thisdate=(localtime)[3
By using day of the week out of locatime, you should be able to determine how
many days you need to add to get to Monday.
Example: Thu is 4 and Mon is 1. So if always looking for the next Monday, then
you can do something like:
my ($sec,$min,$hour,$mday,$mon,$year,$wday
At 05:06 PM 12/6/01 +, Shinagare, Sandeep wrote:
Hi All,
I am trying to find the date, month and year of the next Monday given any
day.
I am using this to get todays date/day/month etc. Is there a way to use
this
information to get the next Monday?
#snip-start
$thisday=(Sun,Mon,Tue,Wed
Sandeep Shinagare wrote:
Hi All,
I am trying to find the date, month and year of the next Monday given any
day.
I am using this to get todays date/day/month etc. Is there a way to use
this
information to get the next Monday?
#snip-start
$thisday=(Sun,Mon,Tue,Wed,Thu,Fri,Sat
This is a question for Perl programmers in the field.
I would like to hear your advice in my next step.
I work presently in a DOS - windows environment. I program
Perl in DOS. It is pretty straight Perl scripts.
Besides some DBI, and a sprinkle of CGI, it's mainly straight Perl.
I learnt
Hi all
I am try to get my first guestbook to work.
I have got it writing to a file, and retrieving,..but only the first
entry in the logfile.
I have delimited the fields in the logfile by ,..and delimited the
last field for each entry with a *.
How do I get it to move to the next entry
Hi, I have this:
print NOUVEAU $newline2\n or die je ne peux écrire dans $nouveau : $!\n;
But it prints but didn't go to the next line(\n seems to be ignored)
Why?
Thanks.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Jorge Goncalvez wrote:
Hi, I have this:
print NOUVEAU $newline2\n or die je ne peux écrire dans $nouveau : $!\n;
But it prints but didn't go to the next line(\n seems to be ignored)
Why?
The newline needs to be in quotes to be interpolated
print NOUVEAU $newline2\n or die je ne peux
Rajeev.
- Original Message -
From: Bill Jones [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, September 30, 2001 5:45 AM
Subject: Re: Same date next month?
On 9/29/01 4:04 PM, wrote:
I have couple of ideas
- if the date is a date that isn't in the next month, just
SO I am closer to webmail. http://www.quantifier.org/emu/ will forward to
the cgi script the way the index.html page tells it to. ALL of the
directories are recursively set up in apache. Why does it serve the script
itself like text? Do I need to define the type in the second line of the
script?
Just guessing: you need to say Apache that it's the cgi script. It's done
like this on my machine:
ScriptAlias /cgi-bin/ "/usr/apache/cgi-bin/"
On Tuesday 26 June 2001 02:16, you wrote:
SO I am closer to webmail. http://www.quantifier.org/emu/ will forward to
the cgi script the way the
on the same line or automatically go the next line?)
Thanks in advance.
--
Esrar
Esrar Chowdhury
CCS Internet
13740 Research Blvd Suite #O-4
Austin, TX 78750
Phone: 512-257-2274
the read pointer read every 10th line
from my input file? (After reading one line, does the read pointer stay
on the same line or automatically go the next line?)
It's probably easiest to read every line, but only process every 10th one.
Something like this should do it:
while (INFILE) {
next
This is just my survey of one small but (imo)
important aspect of perl 6. It will take about
two minutes and six mouse clicks to do it.
I will collate all answers and report to the
people who are designing Perl 6 (including
Larry Wall of course).
101 - 174 of 174 matches
Mail list logo