[NTLUG:Discuss] portable perl question...

MadHat madhat at unspecific.com
Wed Jun 6 08:42:30 CDT 2001


At 11:49 PM 6/5/2001 -0500, Fred James wrote:
>(perhaps not really as off the track as it may seem at first)
>Here I am learning Perl on a Linux machine and I get an opportunity to
>take a class or two in it - what's the catch?
>The class is being taught on MS machines - but of course they promise
>not to be MS specific.
>What's my question?
>Got any hints on what to avoid in Perl on an MS machine - my aim is
>portable, and my interest is Linux.

Remember that a \n (new line) is normally sufficient on non-MS machines, 
while MS can and will use a combination of \n\r (new line and carriage 
return) without you knowing if it is using one or both.  This is important 
when using something like chomp, as it does not work the same on MS as it 
does on Unix style boxes. (ended up having to use s/\n|\r//g I think, or 2 
lines, one for each, can't remember)

Aslo, the difference in / and \.  Remember to use a \ you have to use it 
twice \\ to make sure it is escaped (perl sees \ as an escape character for 
what ever come next, so \n is newline and \c is control, \t is tab, 
etc...), but don't let people lie to you, the / has worked fine on all 
versions of Perl I have used on Win32 (being versions of ActivePerl and 
Cygwin Perl).  Test it and find out for yourself.

There are other differences, like some modules not being portable, but 
there are too many details to list.  These are the 2 items I have had bite 
me in the ass, so here they are.


>The class is suppose to introduce us to CGI in Perl, and right away the
>guy says nobody writes CGI in Perl any more - is that true, or is he
>possibly misinformed?

Perl is still very popular...  even on IIS.  But it is true that many 
people are moving away from perl to ASP, PHP and others like cold 
fusion.  The reason is because of simplified languages (like ColdFusion 
looks like html) and that the designers of these languages are catering to 
the web world and CGIs specifically making more resources available for 
CGIs and ease of development.  Personally, I teach perl and CGI with perl 
and would never use anything else.  I write perl scripts on a daily basis 
and not because it is my job, but because it makes my job easier...


>--
>...small is beautiful...
>_______________________________________________
>http://www.ntlug.org/mailman/listinfo/discuss

--
MadHat at unspecific.com

"Focus on the packet.  It's better that way."
                                              -tb




More information about the Discuss mailing list