[Perl] Como hacer justificaciones a impresion en archivo

Jose Antonio Galicia jcgalici@cbbanorte.com.mx
Fri, 20 Dec 2002 11:10:22 -0600 (CST)


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