Post

If else perl

Penyeleksian kondisi di perl dapat menggunakan syntax if…else dengan format

1
2
3
4
5
if ( kondisi ) {
  ....
  } else {
  ....
  }

Contoh

1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/perl

use strict;
use warnings;
use feature 'say';

my $username = "user";
if ( $username eq "nama" ) {
    say "Oke";
    } else {
    say "Ulangi lagi....";
    }
This post is licensed under CC BY 4.0 by the author.