FreeKB - Perl articles
Perl articles

ArraysGetting Started with ArraysAppend element to the beginning of an array (unshift)Append element to the end of an array (push)Count elements in an arrayCreate array over SSHRemove all elements from array (undef)Remove element beginning of array (shift)Remove element end of array (pop) Remove element from array (splice)Remove empty lines from arrayRemove first element from array (splice)Replace element in array (map)Sort arrayStore files directories in array (glob)Built in Perl commands%ENV environment special hashEscape special characters using quotemeta (\Q \E)eval functionLower case (lc)Random number generator (rand)Update the first character in a string to be upper case (ucfirst)Upper case (uc)Variable contains (=~) or does not contain (!~)Wrap text (Text::Wrap)Command Line Options and FlagsGetting Started with command line options and flagsCountCount characters in a string (length)Count lines in a file ($.)Data::DumperGetting Started with Data::DumperDate TimeDate and time using strftimeDate and time using Time::PieceEpoc date and timeDirectoriesList directoriesFile::BasenameFile::Basename moduleFile::TouchGetting Started with File::TouchFilesPrevious, current, and next line in a file (seek, tell)Transfer a fileFiles - TXT / DOC / CSVDetermine if file contains a string of dataRead a file (<)Read and write to the same fileReplace values in a fileWrite to a file (> and >>)Files - XLSAppend or replace data in an Excel spreadsheet (Spreadsheet::ParseExcel)Read an Excel 95-2003 spreadsheet (xls) Write to an Excel 95-2003 spreadsheet (xls) HashesArray of HashesCount keys and values in a hashHash (append values)Hash (create empty hash)Hash (determine if hash is defined)Hash (determine if hash key is defined)Hash (grep keys)Hash (lock_keys lock_values)Hash (multidimensional hash)Hash (remove values)Hash (sort keys)Hash Array (append key value pairs) Hash Array (append keys)Hash Array (append values)Hash Array (create empty array)Hash Array (determine if hash array defined)Hash Array (remove values)loop through hash keysloop through hash valuesprint hash valuesif elsif else statementsGetting Started with if elsif else statementsDetermine if a directory is emptyInstallInstall a module (cpan)Install Perl on LinuxJSONGetting Started with JSON::ParseJSON Modification of a read-only valueJSON::Parse reason Not Found error Object Not FoundLoggerGetting Started with Log::Log4perl LoggerLoopsBreaking out of a loop (last)foreach loopsLoop through a file until line matchloop through a range of items in an arrayMoving onto next value in a loop (next)while loopMathAddition and Increment (+)Convert hexadecimal to decimalDivision (/)Multiplication (*)Subtraction (-)Sum of integers in a fileModulesCreate your own moduleDetermine if a module is installedOtherNative operating system command (`backticks`)Prompt a user for inputScientific notation with Microsoft ExcelPrinting outputBold text (Term::ANSIColor)Display text on the console (print and say)Regular Expressions (regex)( and ) charactersAppend leading zeros to numberscarriage returns (\r ^M)Dealing with Microsoft Word curly fancy smart quotesDo something end of lineDo something every nth line in a fileDo something range of linesFlatten lists (merge similar lines)Match last occurrence of a line in a filenew lines (\n)Regular expression delimiterReplace text in a file (-pi -e =~)Trailing forward slashUsing grepwhitespace (\s)Returnreturn a hashreturn a stringreturn a variablereturn an arrayreturn in a subroutineSFTPGetting Started with Net::SFTPSpliting stringCut a string into pieces (substr)Split fields at delimiterSQL databaseConnect to a SQL databaseSSHGetting Started with Net::OpenSSHGetting Started with Net::SSH:PerlLocal and remote variables over SSHPublic key authentication with Net::SSH:PerlSubroutinesGetting Started with SubroutinesIdentical subroutine names (package, namespace)Pass values to a subroutine (@_ and $_ and shift)TroubleshootingResolve "Can't locate in @INC" in PerlResolve "Host key for has changed"Variables / ScalarsGetting Started with scalars and variablesAppend values to a variable (.=)Determine if a variable is definedDetermine if a variable is empty or nullGlobal and lexical variables (my)Replace values in a variable (=~)XML::SimpleGetting Started with XML::SimpleData::Dumper and XML::SimpleXML::Simple ArraysXML::Simple ForceArrayXML::Simple Ignore Attributes XML::Simple looping through hash keysXML::Simple looping through keysXML::Simple looping through keys that contain attributesXML::Simple output XML (XMLout)XML::Simple Printing AttributesXML::Simple printing keys (XMLin)XML::Simple printing values (XMLin)XML::Simple store XML in a variable (XMLin)XML::TwigXML::Twig change tag (set_tag)XML::Twig change value (set_text)XML::Twig loop through tags (first_child children)XML::Twig output to a fileXML::Twig parse XML