Lightning flashed, thunder crashed and "Sparkle Williams" <[EMAIL PROTECTED]> 
whispered:
| I'm trying to write a perl script that can distinguish between http and ftp 
| files. I got it to work on my UNIX system using case, but I can't seem to 
| get it to function correctly when I switch to using if-then on my Windows NT 
| system. Does anyone have any ideas as to how I can correctly adjust my 
| script?

Perl has no "case" statement on either UNIX or MS.  I think you are
confusing something you did with a UNIX shell.

|       if ($url)  { HTTP:// };
| 
|          print " You have chosen a file of type HTTP! ";
| 
|       elsif ($url) { FTP:// } ;
| 
|          print "You have chosen a file of type FTP! ";
|      else ($url) {*} ;
| 
|          print "I'm sorry. This program does not support that type of file." 
| ;

I'm not sure where your confusion came from, but this is some kind of wierd
incest between shell and perl.  You want to do some kind of string
comparison, such as:

if ($url eq "HTTP://";) {

or

if ($url =~ /http:/i) {

Your code should resemble this:

if ($url =~ /http:/i) {
...
} elsif ($url =~ /ftp:/i) {
...
} else {
...
}

-spp
--
Stephen P Potter                                         [EMAIL PROTECTED]
"You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a point."        -Simon Cozens
UNIX, Perl, PHP, Web Consulting and Training  http://www.unixlabs.net/~spp/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to