Friday, March 23, 2012

Perl - Converting character string to HEXA string



Substitution Operator Modifiers
Here is the list of all modifiers used with substitution operator
Modifier Description
     i   Makes the match case insensitive
     m   Specifies that if the string has newline or carriage
         return characters, the ^ and $ operators will now
         match against a newline boundary, instead of a
         string boundary
     o   Evaluates the expression only once
     s   Allows use of . to match a newline character
     x   Allows you to use white space in the expression
         for clarity
     g   Replaces all occurrences of the found expression
         with the replacement text
     e   Evaluates the replacement as if it were a Perl statement,
         and uses its return value as the replacement text

References:
http://icfun.blogspot.com/2009/05/perl-convert-character-string-into-hex.html
http://www.tutorialspoint.com/perl/perl_regular_expression.htm