File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 10911
    
  12

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: 10911
    
  12

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: New to Perl
 
Similar Threads
Palindrome
integer palindrome 'no strings'
palindrome not very proficient...
convert perl to java
Palindrome