in reply to An easy way to share Perl codes
See for example here: all \n have lost their backslashes.
I shudder to think what wil happen with programs that use references
Update: I took some more time to look at it and it just gets worse. For example this code: Showing or listing the contents of a directory in sorted order, sorting an array. No strictures enabled, no lexical dirhandle, no lexical variables used at all, uses chop rather than chomp to delete a trailing EOL-character, does not test whether the opendir or readdir functions succeeded, uses unnecessary parentheses in print.
Update 2:Some of these "codes" are downright dangerous: Getting details about a file, filesystem functions, changing modified time and other file attributes. Without any warning, this script truncates the file it just stat-ed to a length of 10 characters. Is this the "filesystem functions" the code wants to show? Verily, of all the "filesystem functions" that exist in Perl, Zybocode has chosen one of the least useful/used and certainly most dangerous for novice programmers.
Update 3: And in Renaming files and directories, defining and using sub routine description, subroutines are called using the &subroutine() syntax.
Update 4: Even the descriptions are misleading. In Searching for a particular word in two text files, checking for matching words in file, Pattern matching using regular expressions(regex) no regex is used at all. The comparison is done by using eq.
OK. I will stop now; I think you get the picture. This is not the site to promote Perl.
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|
|---|