Skip to content
#!/usr/bin/perl
use strict;
use warnings;
my $val = 1;
#first
print "first (if)\n";
if($val > 1){
print "if > 1\n";
}else{
print "else <= 1\n";
}
not functional
#second
print "second (if)\n";
$val = 2;
if($val < 1){
print "if < 1\n";
}unless($val > 1){
print "unless < 1\n";
}
#third
print "third (if)\n";
$val = 'a';
if($val =~ 'a'){
print "if = a\n";
}unless($val =~ 'b'){
print "unless != a\n";
}
result
first (if)
else <= 1
second (if)
third (if)
if = a
unless != a
Related Posts:
Perl - [ Captura Regex ]#!/usr/bin/perl
use strict;
use warnings;
my $capitura = 'From: gnat@perl.com To: camelo@oreilly.com Date: Mon 17 Jul 200 09:00:00 -100 Subject: Nad… Read More
Perl - [ Reference | Array Sub ]
#!/usr/bin/perl
use strict;
use warnings;
my @array = [1,2,3,['a','b',['c']]];
my $rA = \@array;
print"\n[0] = [1,2,3,['a','b',['c']]]";
print"\n[3… Read More
Perl - [ Relational operators ]
numeric string
> &nb… Read More
Perl - [Character class | Change | Replacement | For ]
#!/usr/bin/perl
use strict;
use warnings;
my $name = ' texto gerado automaticamente pelo sistema lattes ';
my $name1;
($name1 = $name) =~ s/o/OoO/g… Read More
Perl - [ Length ]
#!/usr/bin/perl
use strict;
use warnings;
my $collor = 'blue';
print "blue\n" if length($collor) eq 4;
resul
$perl blog.pl
blue… Read More
0 comentários:
Post a Comment