Comparing strings

2002-01-29 Thread ekayes
Hi I wish to do string comparisons where the case is ignored, for example: $one = ExanPle; $two = example; if ($one eq $two){ THIS RETURNS TRUE What do I add so that the comparison ignores the case? Thanks in advance eddie -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: Comparing strings

2002-01-29 Thread Sudarsan Raghavan
[EMAIL PROTECTED] wrote: Hi I wish to do string comparisons where the case is ignored, for example: $one = ExanPle; $two = example; if ($one eq $two){ THIS RETURNS TRUE if (lc($one) eq lc($two)) { #perldoc -f lc HTH, Sudarsan What do I add so that the

Re: Comparing strings

2002-01-29 Thread Chris Zampese
dont know if this helps, but the following code $one = ExamPle; $two = example; if ($one=~/$two/i) { print true ; } print false; outputs: true false (ie evaluates the expression in the curly braces) and if you change the top word to ExanPle (change the m to n) then it only outputs: false

Re: Comparing strings

2002-01-29 Thread Chris Zampese
me again :) Just realised that I did not give you an explanation of why this works... The expression is a simple regex (see Perl Documentation). The =~ is sort of the 'equal to' part, and the i at the end makes the comparison case insensitive. -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: Comparing strings

2002-01-29 Thread Jonathan E. Paton
Don't know if this helps, but the following code $one = ExamPle; $two = example; if ($one=~/$two/i) { print true ; } This is a bad idea for anything other than throwaway scripts... it requires building a full regex everytime (from $two). You *MUST* use quotemeta() on $two to

Re: comparing strings

2002-01-29 Thread Collins, Joe (EDSI\\BDR)
Worth reading, including the end where Jonathan expands on his earlier post. -Original Message- From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 1:32 PM To: Collins, Joe (EDSIBDR) Subject: RE: Comparing strings | Don't know if this helps

problem comparing strings

2001-11-14 Thread samuel
Hi there! i'm seeking for help on something which should b easy, but has turned into my personal hell. i'm trying to compare character (but i guess it applies the same to strings) for my database entry markers, but i simpled the problem out to this: #Here starts my nightmare

Re: problem comparing strings

2001-11-14 Thread Chris Garringer
chomp $character; You need to get rid of the newline character at the end of every string from STDIN On Wed, 14 Nov 2001, samuel wrote: Hi there! i'm seeking for help on something which should b easy, but has turned into my personal hell. i'm trying to compare character (but i guess it

Problem comparing Strings with IF AND

2001-10-29 Thread Kurthin
The program I'm writing (my first in Perl) takes a log file and using a regex pulls out all lines that contains certain words and writes them to a file. Then I read in that file, seperate out the fields I want (IP address and method), and want to eliminate the duplicates, and add a count to show

Re: Problem comparing Strings with IF AND

2001-10-29 Thread Pete Sergeant
Kurt, if ($client ne $newclient and $method ne $newmethod){ print something\n;#I'll actually be printing this to my report once I get this worked out } I think what you want is: if (($client ne $newclient)($method ne $newmethod)) { ... } This is covered

comparing strings

2001-06-22 Thread Nick Transier
Does anyone know a way to make boolean comparisons between strings? For example, I want 'a' 'b' to be true, but perl says 'a' == 'b' is true. Thanks, -Nick _ Get your FREE download of MSN Explorer at http://explorer.msn.com

RE: comparing strings

2001-06-22 Thread Kipp, James
I think : a cmp b ; # -1 ab, 0 a=b, 1 ab -Original Message- From: Nick Transier [mailto:[EMAIL PROTECTED]] Sent: Friday, June 22, 2001 3:31 PM To: [EMAIL PROTECTED] Subject: comparing strings Does anyone know a way to make boolean comparisons between strings? For example, I

RE: comparing strings

2001-06-22 Thread Wagner-David
] Subject: comparing strings Does anyone know a way to make boolean comparisons between strings? For example, I want 'a' 'b' to be true, but perl says 'a' == 'b' is true. Thanks, -Nick _ Get your FREE download of MSN Explorer at http

Re: comparing strings

2001-06-22 Thread Peter Scott
At 02:30 PM 6/22/01 -0500, Nick Transier wrote: Does anyone know a way to make boolean comparisons between strings? For example, I want 'a' 'b' to be true 'a' lt 'b' , but perl says 'a' == 'b' is true. 'a' eq 'b' is false 'a' == 'b' is true because each string is interpreted in a numeric

Re: comparing strings

2001-06-22 Thread Jos I. Boumans
perlop for more on this hth, Jos Boumans - Original Message - From: Nick Transier [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 22, 2001 9:30 PM Subject: comparing strings Does anyone know a way to make boolean comparisons between strings? For example, I want 'a' 'b

Re: comparing strings

2001-06-22 Thread Jos I. Boumans
to prove i sometimes write utter non sence too after a long week: 'foo' == 'bar' is true because they are both ZERO, not because their length is both 3 'bar' == 'quux' too, etc my humble apologies... i'm not sure i follow where you want to go... are you trying to compare ascii value? or

Re: comparing strings

2001-06-22 Thread Paul
--- Jos I. Boumans [EMAIL PROTECTED] wrote: stricly speaking 'foo' == 'bar' since both should yield 3. er? print int('foo'); # prints 0 __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/

Re: [OT] comparing strings

2001-06-22 Thread Paul
--- Jos I. Boumans [EMAIL PROTECTED] wrote: yeah, rub it in... i already corrected it... not sure *what* i was thinking... br4n3 fry... SORRY =) lol -- not that I would criticize a better coder. Just watching out for the nu-B's. Notice *I* didn't even *attempt* to implement Inline::Java.