punkwalrus (punkwalrus) wrote,

  • Mood:

Perl - The class so far

So far, so good. I am learning a lot. The class as it stands gains a solid B. The instructor is interesting, knowledgable, and doesn't take himself seriously.

Some tidbits I learned today:

Changing EOL character
Suppose you are reading a text file, but it's got different "End of Line" characters because it come from a different OS, or some weird proprietary database output (*cough*HP3000*cough*), or you just want it to read whole paragraphs at a time for speed's sake (like for trouble ticket software). You need to set $/, and here's a handy chart:
$/ = 	udef();		# read entire line (default)
	"\n\n";		# read paragraphs
	"0x0D";		# Read Old Mac (OS9 and below) or VMS text files
	"0x0A";		# Read Unix or New Mac (FreeBSD-based, like OSX) text files
	"0x0D0A";	# Read windows text files

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded