eq and =? problem?

G

Geoff Cox

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);
}
 
G

Geoff Cox

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
 
A

Adrian Ulrich

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";
}
 
G

Geoff Cox

Maybe something adds some weird/unwanded chars to $path

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

should display them.



#!/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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top