jQuery in Action, 2nd edition*
The moose likes Perl and the fly likes New to Perl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Languages » Perl
Bookmark "New to Perl" Watch "New to Perl" New topic
Author

New to Perl

Dustin Schreader
Ranch Hand

Joined: May 25, 2009
Posts: 74
I've been looking around about how to find string equality and from what I've seen I just need to use eq but if AT is entered into the following code it's saying its not equal and i'm not sure why.

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11448
    
  16

Well, to be fair, your strings are not equal.

Change line 11 to this:

note the two colons. This shows you that your string isn't what you think it is. it contains EXACTLY what you typed on the command line. and I'm pretty sure you hit THREE keys to get your "AT" (not counting shift or caps lock).

Then I suggest you look up the chomp method of perl.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Dustin Schreader
Ranch Hand

Joined: May 25, 2009
Posts: 74
Thank you for your help. I figured the string wasn't being parsed correctly if I'm saying that right, so I did eventually fall upon the chomp method!
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11448
    
  16

I would say the string is being parsed properly, but it's taking everything you type at the command line, not just what you want.

I had someone at work have this exact same problem last week, except he was reading lines from a file.
 
wood burning stoves
 
subject: New to Perl