开发者

Where can I find simple exercises to practice string manipulation in Perl?

开发者 https://www.devze.com 2023-01-27 07:49 出处:网络
Does anyone know where I can find a collection of very simple exercises on string manipula开发者_如何学JAVAtion in order to practice Perl language?

Does anyone know where I can find a collection of very simple exercises on string manipula开发者_如何学JAVAtion in order to practice Perl language?

I'm learning Perl just to use the resources it has got of string manipulation.


Learning Perl book has lots of exercises as far as I recall.

Also, search StackOverflow on "perl" and ("regex" or "split") and try to answer any questions yourself and then go and understand other people's answers

Also, go through any string manipulation tasks on Rosetta Code and do them in Perl


You could do this simply with Test::More. Do your manipulations and then test your guess:

my $subs1 = substr( 'apple', 0, 1 );
is( $subs1, 'a' );

The underlying testing system will usually tell you what you guessed wrong. If you did this in REPL (since it's very linear), it could serve as a training exercise.


You can start with

my $s = 'PERL';
$s =~ s/PERL/Perl/;

or

$s = ucfirst lc $s;


perldoc -q string

0

精彩评论

暂无评论...
验证码 换一张
取 消