elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [Perl] Funcion printear()
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Perl] Funcion printear()  (Leído 1,698 veces)
BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] Funcion printear()
« en: 11 Octubre 2011, 18:10 pm »

Hola a todos , hoy les traigo una funcion para poder
usar colores en perl para mostrar en el texto que queremos

Código
  1. #By Doddy H
  2.  
  3. use Color::Output;
  4. Color::Output::Init;
  5.  
  6. sub printear {
  7. if ($_[1] eq "text") {
  8. cprint("\x03".$_[2].$_[0]."\x030\n");
  9. }
  10. elsif ($_[1] eq "stdin") {
  11. if ($_[3] ne "") {
  12. cprint("\x03".$_[2].$_[0]."\x030"."\x03".$_[3]);
  13. my $op = <stdin>;
  14. chomp $op;
  15. cprint ("\x030");
  16. return $op;
  17. }
  18. }
  19. else {
  20. print "error\n";
  21. }
  22. }
  23.  
Sintasis

Código:
printear("text","text/stdin","color text","color output")

Ejemplos de uso

Con texto normal


Código
  1. printear("hola","text","10","5");
  2.  

Texto con entrada de teclado

Código
  1. my $d  = printear("nombre : ","stdin","6","2");
  2. print "pusiste $d\n";
  3.  


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Funcion Ip Publica [Perl]
Scripting
isseu 2 2,978 Último mensaje 8 Mayo 2010, 00:17 am
por leogtz
[Perl] Funcion Speak()
Scripting
BigBear 0 1,547 Último mensaje 10 Octubre 2011, 16:51 pm
por BigBear
[Perl] Funcion wormer()
Scripting
BigBear 0 1,381 Último mensaje 10 Octubre 2011, 16:51 pm
por BigBear
[Perl] Funcion writeword()
Scripting
BigBear 0 1,429 Último mensaje 10 Octubre 2011, 16:52 pm
por BigBear
[Perl] Funcion movewin()
Scripting
BigBear 0 1,385 Último mensaje 11 Octubre 2011, 18:08 pm
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines