Friday, March 9, 2012

Perl - Function Substr

#!/usr/bin/perl
use strict;
use warnings;

my $phrase  = 'This is friend "command line"';

my $friend = substr($phrase,16,12);

print "$friend\n";

my $this = substr($phrase,0,4);

print "$this\n";

result:

> perl blog.pl
command line
This

0 comentários:

Post a Comment