Re: if statement being ignored

2009-04-15 Thread Robert Citek
On Wed, Apr 15, 2009 at 6:33 AM, John W. Krahn wrote: > Robert Citek wrote: >> >> You probably want ($Lang == "fr") > > Probably not. You are using a numerical comparison on a string which will > convert the string to a number so that is the same as saying: ($Lang == 0) You are correct. Serves

Re: if statement being ignored

2009-04-15 Thread Chas. Owens
On Wed, Apr 15, 2009 at 07:33, John W. Krahn wrote: > Robert Citek wrote: >> >> On Wed, Apr 15, 2009 at 12:08 AM, Brian wrote: >>> >>> could someone please help me with this little problem? >>> I am trying to include an if statement part way through printing. >>> When the program reaches the line

Re: if statement being ignored

2009-04-15 Thread John W. Krahn
Robert Citek wrote: On Wed, Apr 15, 2009 at 12:08 AM, Brian wrote: could someone please help me with this little problem? I am trying to include an if statement part way through printing. When the program reaches the line if ($Lang = fr ) { print " that line gets ignored and the cgi keeps g

Re: if statement being ignored

2009-04-15 Thread Robert Citek
You probably want ($Lang == "fr") Regards, - Robert On Wed, Apr 15, 2009 at 12:08 AM, Brian wrote: > could someone please help me with this little problem? > I am trying to include an if statement part way through printing. > When the program reaches the line if ($Lang = fr ) { print " > that

Re: IF statement and multiple options

2006-10-19 Thread Tom Phoenix
On 10/19/06, Robert Hicks <[EMAIL PROTECTED]> wrote: I am currently building the IF statement like: if ($project_name eq 'Proj1' || $project_name eq '' && $task_name eq '') Because logical-and is higher precedence than logical-or, that condition is the same as this: $project_name eq 'Proj

Re: IF statement and multiple options

2006-10-19 Thread Rob Dixon
Robert Hicks wrote: > I am currently building the IF statement like: > > if ($project_name eq 'Proj1' || $project_name eq '' && $task_name eq '') > > > That works but I was wondering if I can do this: > > if ($project_name eq ('Proj1' || '') && $task_name eq '') > > Less typing... : ) No. Because

Re: If Statement Nested Regular Exp.

2002-12-19 Thread Jenda Krynicky
From: "Paul Kraus" <[EMAIL PROTECTED]> > Any ideas why this fails. If I remove if /aged/ and just have the if > /Reports ... then everything works ok. > > Code > #!/usr/bin/perl > my @files; > my %age; > push (@files, glob "Aged*"); > push (@files, glob "Receipts*"); > > foreach (@files){ >

RE: If Statement Nested Regular Exp.

2002-12-19 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Paul, I would say it is your last \s+ which probably should be written \s* which says there may or may not be whitespace after the last number you find. With the plus there must be at least one white space. Wags ;) -Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED]] Se

Re: if statement not validating properly

2002-11-27 Thread Rob Dixon
Larry You're right - you should be using 'eq'. But I can't imagine why it's not working. Try hard-coding a value for $ip and trying it that way: $ip = "192.168.100.377"; if ( $ip eq "192.168.100.100" ) { &process_form; } else { &generate_form("NOT A VALID

Re: if statement not validating properly

2002-11-27 Thread John W. Krahn
Larry Sandwick wrote: > > In the program below the if statement that qualifies the IP address > never evaluates to be false, for what ever reason the form is always > processed. Can anybody help me with this problem? > > The code should only allow computers with certain IP's to access the > data

Re: if statement

2002-08-12 Thread John W. Krahn
Javeed Sar wrote: > > I have a small doubt; > > My script is given below: > What it is doing is once the first condition is satisfied it is dieing, that > is if (($check_out == 0) > > I want the if statement to compare this also: > (($var5 == "Soarian_Context_Sensitive_Coordination_File") | (

Re: if statement

2002-08-12 Thread Sudarshan Raghavan
On 12 Aug 2002, Felix Geerinckx wrote: > If you initialize your hash-values with '1', you don't need the > 'exists', which makes the statement even more readable: > > if (!$check_out && $cannot_co{$var5}) { > die "..."; > } Right, should have noticed that. Thanks :-) -- To

Re: if statement

2002-08-12 Thread Felix Geerinckx
on Mon, 12 Aug 2002 13:45:21 GMT, [EMAIL PROTECTED] (Sudarshan Raghavan) wrote: > Instead of these multiple conditions why not create a hash of files > that cannot be checkedout. Something like, > my %cannot_co = ( comEPRHelp => 1, ); > > After this your condition will be > if (($check_ou

Re: if statement

2002-08-12 Thread Sudarshan Raghavan
On Mon, 12 Aug 2002, Javeed SAR wrote: > > > I have a small doubt; > > > My script is given below: > What it is doing is once the first condition is satisfied it is dieing, that > is if (($check_out == 0) > > I want the if statement to compare this also: > (($var5 == "Soarian_Context_Sen

Re: if statement

2002-08-12 Thread Felix Geerinckx
on Mon, 12 Aug 2002 07:32:48 GMT, [EMAIL PROTECTED] (Javeed Sar) wrote: > I want the if statement to compare this also: > (($var5 == "Soarian_Context_Sensitive_Coordination_File") | > ($var5 == > "comEPRHelp") | ($var5 == > "CDMS_Context_Sensitive_Coordination_File") | If you want to compa

RE: if-statement and grep in one go

2002-06-25 Thread Marco Antonio Valenzuela Escárcega
On Tue, 2002-06-25 at 03:28, David vd Geer Inhuur tbv IPlib wrote: > > Hello, > > Thanks for the solution Bob. > Changed some stuff and have 2 questions open. > > my $line; > my (%u, %g); > open(FILE, "< ${dir}/user.perm") or print "Failed opening file $!"; ## 1 > while ($line =

RE: if-statement and grep in one go

2002-06-25 Thread Bob Showalter
> -Original Message- > From: David vd Geer Inhuur tbv IPlib > [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 25, 2002 6:28 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; > [EMAIL PROTECTED] > Subject: RE: if-statement and grep in one go > > > > Hello,

RE: if-statement and grep in one go

2002-06-25 Thread Felix Geerinckx
on Tue, 25 Jun 2002 10:28:07 GMT, [EMAIL PROTECTED] (David Vd Geer Inhuur Tbv Iplib) wrote: > Changed some stuff and have 2 questions open. > [code snipped] > 1) I don't like to die in my script as there are many files to >read. And if I can't open the current file I just want to >con

RE: if-statement and grep in one go

2002-06-25 Thread David vd Geer Inhuur tbv IPlib
Hello, Thanks for the solution Bob. Changed some stuff and have 2 questions open. my $line; my (%u, %g); open(FILE, "< ${dir}/user.perm") or print "Failed opening file $!"; ## 1 while ($line = ) { ## 2 if ($line =~ /^user:/) {

Re: if-statement and grep in one go

2002-06-24 Thread drieux
On Monday, June 24, 2002, at 06:12 , Bob Showalter wrote: David's original file format info: >> an example of the file user.perm would be : >> >> user: vdgeerd, tester >> group: none, >> descr: all, > I think you need to parse this file into some structures rather > than using the simple regex a

RE: if-statement and grep in one go

2002-06-24 Thread Bob Showalter
> -Original Message- > From: David vd Geer Inhuur tbv IPlib > [mailto:[EMAIL PROTECTED]] > Sent: Monday, June 24, 2002 6:03 AM > To: [EMAIL PROTECTED] > Subject: if-statement and grep in one go > > > > Hi, > > I need some help on the following. > In my script I show users some infodocs

Re: if-statement and grep in one go

2002-06-24 Thread John W. Krahn
David Vd Geer Inhuur Tbv Iplib wrote: > > Hi, Hello, > I need some help on the following. > In my script I show users some infodocs after they are verified to be valid users. > Users can have the permissions following the ruleset: > - user (all perm) > - group (all perm), > - descr (Not allowed

RE: If statement

2002-03-31 Thread Zeus Odin
Please note the error (WRONG) below. Apologies. -- #!D:\perl\bin\perl -w use strict; my %data; # fill in 11 other states my @state = qw(MA CI DE IN OH); # Make each element of @state a key of hash %data # Set each value equal to 1 (true) # Refer to Perl Cookbook # Recipe 4

RE: If statement

2002-03-31 Thread Zeus Odin
#!D:\perl\bin\perl -w use strict; my %data; # fill in 11 other states my @state = qw(MA CI DE IN OH); # Make each element of @state a key of hash %data # Set each value equal to 1 (true) # Refer to Perl Cookbook # Recipe 4.7: Finding Elements in One Array but Not Another $data{ @state } = (

Re: If statement

2002-03-29 Thread Chas Owens
On Fri, 2002-03-29 at 11:46, Ned Cunningham wrote: > HI, > I am having a very newbie problem. > I am reading an Access database with ODBC and have my data read into > > $Data{STATE} > > My problem is now I need to match to 16 different states. > > > > I have so far > > If ( $Data{STATE} eq "

Re: If statement

2002-01-10 Thread walter valenti
Ther'isn syntax error. How failing ?? > I want the following statement to do something if either of this conditions > exist. "or" Statement > > if ((substr($_, 42, 7) eq "Running") || (substr($Nextline, 42, 7) eq > "Running")) > > It is reading the right substrings but failing. > What am I doin

RE: If...Statement

2002-01-08 Thread Jonathan E. Paton
> | for(my $i=0; $i<22; $i++){}; > | $_=; > | my $line=$_; > | my $nextline=$line++; > | if ((substr($line, 42, 7) eq "Running") || > | (substr($nextline, 42, 7)eq > | "Running")) > > > > while () { > ># Skip lines upto line 23 > >next if $.<22; > > > ># Process for line 23 & 24

RE: If...Statement

2002-01-08 Thread Jonathan E. Paton
> for(my $i=0; $i<22; $i++){}; #This will put > you at row 23. > $_=; > my $line=$_; > my $nextline=$line++; > if ((substr($line, 42, 7) eq "Running") || > (substr($nextline, 42, 7)eq > "Running")) while () { # Skip lines upto line 23 next if $.<22; # Process for li

Re: If...Statement

2002-01-08 Thread Dave K
The question is a bit fuzzy, but try this at the command line, just for fun: perl -e 'my $line = "abrabracadabra";print $line++, " ", $line, "\n";' then consider this: #!D:/cygwin/bin/perl my ($i, $line, $nextline); open (TEXTF, "c:/temp/somelines.txt") or die "Evil forces keep me for doing what

RE: If...Statement

2002-01-08 Thread McCollum, Frank
I am not sure, but I think it has to do with $nextline=$line++; It sounds like $line is a text string and you are autoincrementing it here? Maybe what you really want is $nextline++; to count the number of lines? -Original Message- From: Lance Prais [mailto:[EMAIL PROTECTED]] Sent: Tues

Re: If...Statement

2002-01-08 Thread Jeff 'japhy' Pinyan
On Jan 8, Lance Prais said: >for(my $i=0; $i<22; $i++){}; #This will put you at row 23. > $_=; > my $line=$_; > my $nextline=$line++; $line is a line of text from the file. Adding 1 to it will not make it the next line of the file. Also, $this = $that++ doesn't do what you might think

RE: if statement question

2001-10-25 Thread Bradshaw, Brian
That fixed that. Too much Java nd PHP. Thanks Bob. -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 25, 2001 11:19 AM To: 'Bradshaw, Brian'; [EMAIL PROTECTED] Subject: RE: if statement question > -Original Message- >

RE: if statement question

2001-10-25 Thread Bob Showalter
> -Original Message- > From: Bradshaw, Brian [mailto:[EMAIL PROTECTED]] > Sent: Thursday, October 25, 2001 11:14 AM > To: [EMAIL PROTECTED] > Subject: if statement question > > > Hi list, > > I have some strange goings on in my code. and it might be the > if statement. > > I have the

Re: If Statement won't work

2001-08-06 Thread Brent Michalski
Works fine for me It prints a "1", just like it is supposed to. Are you looking for some other behavior??? Brent mail@redhotsw

RE: If Statement won't work

2001-08-05 Thread Steve Howard
eve H. -Original Message- From: Michael Fowler [mailto:[EMAIL PROTECTED]] Sent: Sunday, August 05, 2001 10:02 PM To: Steve Howard Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: If Statement won't work On Sun, Aug 05, 2001 at 09:51:15AM -0500, Steve Howard wrote: > By any chance

Re: If Statement won't work

2001-08-05 Thread Michael Fowler
On Sun, Aug 05, 2001 at 09:51:15AM -0500, Steve Howard wrote: > By any chance are you using Activestate? I have no explanation, but I have > run across two or three times when everything should have worked, the > variable evalueated to what it should have been, but the if refused to > return true

RE: If Statement won't work

2001-08-05 Thread CDitty
That is it. I downloaded activestate to play with. I'm glad that I am not loosing my mind and that someone else had this problem too. Thanks for putting me at ease. Chris At 09:51 AM 8/5/2001, Steve Howard wrote: >By any chance are you using Activestate? I have no explanation, but I have >ru

RE: If Statement won't work

2001-08-05 Thread Steve Howard
By any chance are you using Activestate? I have no explanation, but I have run across two or three times when everything should have worked, the variable evalueated to what it should have been, but the if refused to return true and execute. those three times I have been able to delete the line and

Re: If Statement won't work

2001-08-04 Thread Ron Smith
The following works for me: --snip- #!/usr/bin/perl -w use strict; my $winner = 1; if ($winner == 1) { print "$winner\n"; } --snip- The above yeilds: 1 If you wanted to print "winner", then remove the '$' from the "print" statement ;-). Oh Yeah! ...

Re: If Statement won't work

2001-08-03 Thread Carl Rogers
At 11:22 AM 8/2/2001 -0500, [EMAIL PROTECTED] wrote: >Can anyone tell me why my if statement refuses to work? It is really >simple. I can't understand it. > >$winner = 1; >if($winner == 1){ >print "$winner\n"; >} Are you expecting the word "winner" to appear??? I've sometimes got so lost in c

Re: if statement

2001-06-21 Thread Jos Boumans
concider: if(not ($foo == 1) ) { print "foo" } it prints 'foo' just as expected... one can use 'not' without too many worries... just remember 2 things: ! has higher precedence (ie, it 'binds tighter') so parentheses would be required if you use ! here instead of 'not' further more, ! is a unary

Re: if statement

2001-06-20 Thread Jos I. Boumans
i'd say, there is no 'like' operator... hth, Jos - Original Message - From: "Ward, Stefan" <[EMAIL PROTECTED]> To: "Perl Beginners (E-mail)" <[EMAIL PROTECTED]> Sent: Thursday, June 21, 2001 12:03 AM Subject: if statement > This isn't working for me. Help please. What is wrong with