Comparing Strings

Why wont this compare correctly, all the log file names are in the array and they display fine, but the compare is not evaluating correctly.....It executes the if statement everytime, when it should only do it if the current log file name does not match one of the 3 in the statement.

##########################################################
#gets the log file names and chops off the beggining paths
##########################################################
sub getLogNames {
    #This puts every file in the $logPath directory in the array @logFileNames
    @logFileNames = <$logPath*>;

    #Iterates through the filenames and chops the pathname off the file
     $index = 0;
     foreach $x (@logFileNames){
         #Does the chopping off of the pathname
       $x =~ s#.*/##;
       $logFileNames[$index] = $x;
       chomp $x;
       if (($x ne 'albd_log') || ($x ne 'db_server_log') || ($x ne 'view_log')){
           print "$x \n";
           $logFileNames[$index] = "";
       }
         $index ++;
     }
    print "CONTAINS ======> @logFileNames \n";

}
Pheonix911Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

manav_mathurCommented:
Shouldnt the || be replaced with &&

Manav
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
manav_mathurCommented:
if your filename is albd_log, first if condition evaluates false but second and third evaluate true. hence, in case of ||, the entire expression is true.

Infact, the entire expression will never be false because a file cannot have 3 names.

<amab
0
Pheonix911Author Commented:
Im feeling a little slow today, cant belive I didnt catch that....thanx for the help
0
manav_mathurCommented:
happens everytime....:-)

Manav
0
manav_mathurCommented:
But why  a B?? Is there anything else that I didnt elaborate on??

Manav
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.