Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > eq and =? problem?

Reply
Thread Tools

eq and =? problem?

 
 
Geoff Cox
Guest
Posts: n/a
 
      03-20-2007
Hello,

It would seem that the following code does not distinguish between the
"bp" and the "bplanning". I thought that using eq and not =~ would
work.

Any ideas please?

Cheers

Geoff

elsif ( $path eq
"docs/applied-business/as/classroom-notes/edexcel/unit2/bp" ) {
intro($path);
appliedbusinessclassroomnotesedexcelunit2bp($path) ;
}

elsif ( $path eq
"docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning" ) {
intro($path);
appliedbusinessclassroomnotesedexcelunit2bplanning ($path);
}
 
Reply With Quote
 
 
 
 
Adrian Ulrich
Guest
Posts: n/a
 
      03-20-2007

> Any ideas please?


This works just fine for me.

How about providing the full script or a simple testcase?

 
Reply With Quote
 
 
 
 
Geoff Cox
Guest
Posts: n/a
 
      03-20-2007
On Tue, 20 Mar 2007 10:41:29 +0100, Adrian Ulrich
<(E-Mail Removed)> wrote:

>
>> Any ideas please?

>
>This works just fine for me.
>
>How about providing the full script or a simple testcase?


Adrian,

Thanks for your reply . odd!

I will try again myself. As it stands I am taking info from a MySQL
data base, a collection of php files and html files so not easy to
come up with a simple test case but will give this a try.

I found a solution by changing the bp to bisplans to avoid any
confusion between bp and bplann.

How did you test out the code I posted?!

Cheers

Geoff
 
Reply With Quote
 
Adrian Ulrich
Guest
Posts: n/a
 
      03-20-2007
> I found a solution by changing the bp to bisplans to avoid any
> confusion between bp and bplann.


Maybe something adds some weird/unwanded chars to $path

print unpack("H*", $path)."\n";

should display them.


> How did you test out the code I posted?!


#!/usr/bin/perl
use strict;
my $path = "docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning";
if ( $path eq "docs/applied-business/as/classroom-notes/edexcel/unit2/bp" ) {
die "1\n";
}
elsif ( $path eq "docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning" ) {
die "2\n";
}
else {
die "3\n";
}
 
Reply With Quote
 
Geoff Cox
Guest
Posts: n/a
 
      03-20-2007
On Tue, 20 Mar 2007 21:54:51 +0100, Adrian Ulrich
<(E-Mail Removed)> wrote:

>> I found a solution by changing the bp to bisplans to avoid any
>> confusion between bp and bplann.

>
>Maybe something adds some weird/unwanded chars to $path
>
>print unpack("H*", $path)."\n";
>
>should display them.
>
>
>> How did you test out the code I posted?!

>
>#!/usr/bin/perl
>use strict;
>my $path = "docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning";
>if ( $path eq "docs/applied-business/as/classroom-notes/edexcel/unit2/bp" ) {
> die "1\n";
>}
>elsif ( $path eq "docs/applied-business/as/classroom-notes/edexcel/unit2/bplanning" ) {
> die "2\n";
>}
>else {
> die "3\n";
>}



Thanks Adrian - will give that a go.

Cheers

Geoff
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
if and and vs if and,and titi VHDL 4 03-11-2007 05:23 AM



Advertisments