Tutorials Point


  Perl Home

  PERL Functions

© 2011 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL y/// Function



Syntax

y/SEARCHLIST/REPLACEMENTLIST/


Definition and Usage

Identical to the tr/// operator; translates all characters in SEARCHLIST into the corresponding characters in REPLACEMENTLIST. It does character by character conversion

Return Value

  • Number of characters modified

Example

#!/usr/bin/perl -w

$string = 'the cat sat on the mat.';

# This will generate a upper case string
$string =~ y/a-z/A-Z/;

print "$string\n";

It will produce following results:

THE CAT SAT ON THE MAT.


Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names