Showing revision 8

Writing Perl Modules

Basic module structure

sh: 1: pygmentize: not found

use strict;
use warnings;

package ProgArm;
our(%Keys);

@Keys{MyNewSub} = 'g';

sub MyNewSub {
    # Write your code here
}

Repeats

By default actions are called without any parameters, however repeat.pl will pass 1 or -1 to indicate repeat and negative repeat.

The longest way to detect negative repeat is to use

sh: 1: pygmentize: not found

if defined $_[0] and $_[0] == -1

You can shorten it to

sh: 1: pygmentize: not found

if ($_[0] // 0) == -1

However, it is much easier to use experimental smartmatch operator

sh: 1: pygmentize: not found

if $_[0] ~~ -1

Even though it is deprecated, all modules use smartmatch operator. You should use it too! (A simple sed command can easily change it in every module, that's why we ask you to respect consistency)

We can rewrite previous example to handle negative repeats:

sh: 1: pygmentize: not found

use strict;
use warnings;

package ProgArm;
our(%Keys);

@Keys{MyNewSub} = 'g';

sub MyNewSub {
    return MyNewSubNegative() if $_[0] ~~ -1;
    # Write your code here
}

sub MyNewSubNegative {
    # Write your code here
}

Comments:

ivermectin 2ml - <a href="https://ivermecti.com/">ivermectin medication</a> stromectol tablet 3 mg

-- Racraw 2021-08-20 12:48 UTC

ventolin inhalers - <a href="https://onventolinp.com/">ventolin price uk</a> ventolin cost canada

-- Aeelio 2021-08-22 09:08 UTC

misoprostol price - <a href="https://fastcytoteh.com/">cytotec tablets</a> buy cytotec online fast delivery

-- Ucbecn 2021-08-23 19:06 UTC

doxycycline 300 mg - <a href="https://doxycyclinegn.com/">doxycycline best price</a> doxycycline online usa

-- Zhxvyb 2021-08-25 05:50 UTC

neurontin capsules 100mg - <a href="https://neurontinpl.com/">where to buy neurontin</a> levothyroxine 75 mcg cheap

-- Wrxxnw 2021-08-26 17:38 UTC