|
From: missoula on 7 Sep 2005 17:33 $string1 eq $string2 will the above just compare the first letter of the 2 strings or compare the whole string.
From: John Bokma on 7 Sep 2005 17:49 "missoula" <rva_ec(a)yahoo.com> wrote: > $string1 eq $string2 > > will the above just compare the first letter of the 2 strings or > compare the whole string. If in doubt *always* check the documentation. Don't waste time of other people. -- John Small Perl scripts: http://johnbokma.com/perl/ Perl programmer available: http://castleamber.com/ Happy Customers: http://castleamber.com/testimonials.html
From: Sherm Pendley on 7 Sep 2005 17:55 "missoula" <rva_ec(a)yahoo.com> writes: > $string1 eq $string2 > > will the above just compare the first letter of the 2 strings or > compare the whole string. The whole string. If you want to compare just the first character of two strings, one way is to use eq and substr together: if (substr($string1,0,1) eq substr($string2,0,1)) { # First characters match. } sherm-- -- Cocoa programming in Perl: http://camelbones.sourceforge.net Hire me! My resume: http://www.dot-app.org
|
Pages: 1 Prev: array question (newbie) Next: retrieving Dell Service Tags using Perl |