On Tue, Dec 21, 2004 at 12:29:58PM +0300, Alexei Alexandrov wrote:
> Sorry, for reposting - not sure that this message is on the list since
> I posted it via Google services previously which might be not
> correct...
> 

I don't remember seeing the first message, so it probably didn't
get accepted onto the perl.org list servers from google.

> I don't know if it's a right place to post my message but anyway...

Arguably it is the correct place. (ie more correct than the perl5-porters
list)

> I guess perltrap doc page should be updated regarding perl vs. shell
> bevavior differences. Today I ran into problem with my shell script
> when I tried to compare strings with -eq operator. Oops, I was quite
> surprises to learn that it's for numbers! And == operator is for
> strings... Quite the contrary, in Perl we use == to treat vars as
> numbers and eq - for strings.


Ooh. Interesting. Well spotted. I added this item to perltrap:

=item *

The shell's C<test> uses "=", "!=", "<" etc for string comparisons and "-eq",
"-ne", "-lt" etc for numeric comparisons. This is the reverse of Perl, which
uses C<eq>, C<ne>, C<lt> for string comparisons, and C<==>, C<!=> C<< < >> etc
for numeric comparisons.

Nicholas Clark

Reply via email to