[Perl] Como hacer justificaciones a impresion en archivo

Max de Mendizábal max@upn.mx
Fri, 20 Dec 2002 14:28:55 -0600


El FORMAT no debe estar dentro de ninguna subrutina.
Saludos
Max
At 12:34 p.m. 20/12/2002 -0500, Ricardo Cumberbatch L. (PANNet - URC) wrote:
>Esto es la subrutina q yo cree, alli esta todo, q puedo hacer para q me
>funcione el 'format'. Ademas no entendi tus ejemplos disculpa
>
>sub Creator {
>
>         $login = $name . $suname . $Facultad{ $facult } . sprintf
>("%02d",$cont);
>         $passwd = Soppasswd();
>         open (PASSWD, ">$datainfo/password");
>         print PASSWD "$passwd";
>         close (PASSWD);
>         format PRINTER =
>         @<<<<<<<<< @<<<<<<<<<<<<<< @<<<<<<<<<<< @<<<<<<<<<<< @<<<<<<<<< 
> @<<<<<<<<<
>         $linea1[0],$linea1[1],     $linea1[2],  $linea1[3],  $login, 
> $passwd
>         .
>         #write (PRINTER);
>         system("useradd -c '$linea1[0] $linea1[1]' -d /dev/null $login");
>         system("passwd --stdin $login < $datainfo/password");
>         open (PRINTER, ">>$datainfo/Students_creados");
>         #open (IMPRIMIR, ">>$datainfo/Students_creados");
>         select (PRINTER); write;
>         #print IMPRIMIR "$linea1[0] $linea1[1]          $linea1[2]
>$fac            $login          $passwd\n";
>         #print ("Tu $linea1[0] $linea1[1] tu login es $login, tu password
>es $passwd, eres el usuario $cont de cedula $linea[2]\n");
>         print "\n";
>}# FIN de la subrutina Creator
>
>Gracias por la ayudas y dispensen el abuso
>
>
> > On Fri, 20 Dec 2002, Ricardo Cumberbatch L. (PANNet - URC) wrote:
> >
> > > format PRINTER =
> > > @<<<<<<<<< @<<<<<<<<<<<<<< @<<<<<<<<<<< @<<<<<<<<<<< @<<<<<<<<< 
> @<<<<<<<<<
> > > $linea1[0],$linea1[1],     $linea1[2],  $linea1[3],  $login,    $passwd
> > > .
> >
> > >     #write (PRINTER);
> >
> >  Antes de esto, supongo, asigna el filehandle "PRINTER"
> > con un open. ¿Verdad?
> >
> > >     #system("useradd -c '$linea1[0] $linea1[1]' -d /dev/null $login");
> > >     #system("passwd --stdin $login < $datainfo/password");
> > >     open (IMPRIMIR, ">>$datainfo/Students_creados");
> > >     write (PRINTER);
> >
> >  Aquí imprimes nuevamente al mismo filehandle, ¿o estas
> > cerrando y abriendo? Si este fuera el caso tal vez sea más
> > rápido usar "select" y STDUOT pero con la penalización que
> > tendrias siempre conectados los filehandles.
> >
> > > Format not terminated at generaruser.pl line 222, at end of line
> > > Missing right curly or square bracket at generaruser.pl line 222, at end
> > > of line
> > > syntax error at generaruser.pl line 222, at EOF
> > > Execution of generaruser.pl aborted due to compilation errors.
> >
> >  Ve:
> >
> >       $ perl -e 'format =
> >       @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> >       $L[0],$L[4]
> >       .
> >       open F, "/etc/passwd"; while (<F>){@L=split ":"; write}'
> >
> >
> >       $ perl -e 'format SALE =
> >       @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> >       $L[0],$L[4]
> >       .
> >       open F, "/etc/passwd"; open SALE, ">/tmp/salida"; while 
> (<F>){@L=split ":"; write SALE}'
> >       $ cat /tmp/salida
> >
> >
> >       perl -e 'format =
> >       @>>>>>>>>>>>> @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> >       $L[0],$L[4]
> >       .
> >       format SALE =
> >       @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> >       $L[0],$L[4]
> >       .
> >       open F, "/etc/passwd";open SALE, ">/tmp/salida";
> >       while (<F>) {
> >         @L=split ":";
> >         $of = select (SALE); write;
> >         select ($of); write;
> >       }'
> >       $ cat /tmp/salida
> >
> >  Espero que estos ejemplo te aclaren el panorama.
> >
> >  Saludos,
> >  Toño
> > ---
> > FORTUNE REMEMBERS THE GREAT MOTHERS: #5
> >
> >       "And, and, and, and, but, but, but, but!"
> >               -- Mrs. Janice Markowsky, April 8, 1965
> >
> > _______________________________________________
> > Perl mailing list
> > Perl@tlali.iztacala.unam.mx
> > http://tlali.iztacala.unam.mx/mailman/listinfo/perl
> >
>
>_______________________________________________
>Perl mailing list
>Perl@tlali.iztacala.unam.mx
>http://tlali.iztacala.unam.mx/mailman/listinfo/perl