• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

Perl [Perl] Funcion printear()

Status
Not open for further replies.

Doddy

Leech
User
Joined
Apr 1, 2012
Messages
169
Reputation
0
Reaction score
406
Points
63
Credits
0
‎13 Years of Service‎
57%
Hola a todos , hoy les traigo una funcion para poder usar colores en perl para mostrar en el texto que queremos.

El codigo :

Code:
>
#By Doddy H

use Color::Output;
Color::Output::Init;

sub printear {
if ($_[1] eq "text") {
cprint("\x03".$_[2].$_[0]."\x030\n");
}
elsif ($_[1] eq "stdin") {
if ($_[3] ne "") {
cprint("\x03".$_[2].$_[0]."\x030"."\x03".$_[3]);
my $op = ;
chomp $op;
cprint ("\x030");
return $op;
}
}
else {
print "error\n";
}
}
Sintasis

Code:
>
printear("text","text/stdin","color text","color output")
Ejemplos de uso

Con texto normal

Code:
>
printear("hola","text","10","5");
Texto con entrada de teclado

Code:
>
my $d  = printear("nombre : ","stdin","6","2");
print "pusiste $d\n";
 
Status
Not open for further replies.
Back
Top