Perl - que esta mal?.. ojala me ayuden

 
Vista:

que esta mal?.. ojala me ayuden

Publicado por Dark_Master (1 intervención) el 01/12/2003 15:17:32
tengo esto

print"Ingrese string: ";

$st=<stdin>

$largo=strlen($st);

print"$largo";

for($i=0; $i<$largo; $i++)

{$string[$i]=substr($st,$i,1);

}

for ($j=0; $j<$d; $j++)

{ print"$string[$j]";


}

pero me tira error en el strlen como se ocupa bien eso de ante mano gracias...
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

RE:que esta mal?.. ojala me ayuden

Publicado por Martin Moya (20 intervenciones) el 01/12/2003 22:22:45
Esta utilizando mal la funcion debes utilizarla de la siguiente manera
$largo=len($st);

Saludos.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

porque no me corren los datos correctamente

Publicado por paola (1 intervención) el 18/03/2008 03:30:07
Program ordenar;
uses wincrt;
var
a,b,c,d:integer;
begin
writeln('Ingrese 4 números');
readln(a,b,c,d);
{Comparación para el mayor}
if a>b then
if a>c then
if a>d then
writeln('Primero ',a);
if b>c then
if b>d then
writeln('Segundo ',b);
if c>d then
writeln('Tercero ',c);
if c>d then
writeln('Cuarto ',d)
else
if c>b then
if c>d then
writeln('segundo',c);
if b>d then
writeln('Tercero ',b);
if b>d then
writeln('Cuarto ',d)
else
if d>b then
if d>c then
writeln('segundo',d);
if b>c then
writeln('Tercero ',b);
if b>c then
writeln('Cuarto ',c);
if b>a then
if b>c then
if b>d then
writeln('Primero ',b);
if a>c then
if a>d then
writeln('Segundo ',a);
if c>d then
writeln('Tercero ',c);
if c>d then
writeln('Cuarto ',d)
else
if c>a then
if c>d then
writeln('segundo',c);
if a>d then
writeln('Tercero ',b);
if a>d then
writeln('Cuarto ',a)
else
if d>a then
if d>c then
writeln('segundo',d);
if a>c then
writeln('Tercero ',a);
if a>c then
writeln('Cuarto ',c);
if c>a then
if c>b then
if c>d then
writeln('Primero ',c);
if a>b then
if a>d then
writeln('Segundo ',a);
if b>d then
writeln('Tercero ',b);
if b>d then
writeln('Cuarto ',d)
else
if b>a then
if b>d then
writeln('segundo',b);
if a>d then
writeln('Tercero ',a);
if a>d then
writeln('Cuarto ',d)
else
if d>a then
if d>b then
writeln('segundo',d);
if a>b then
writeln('Tercero ',a);
if a>b then
writeln('Cuarto ',b);
if d>a then
if d>b then
if d>c then
writeln('Primero ',d);
if a>b then
if a>c then
writeln('Segundo ',a);
if b>c then
writeln('Tercero ',b);
if b>c then
writeln('Cuarto ',c)
else
if b>a then
if b>c then
writeln('segundo',b);
if a>c then
writeln('Tercero ',a);
if a>c then
writeln('Cuarto ',c)
else
if c>a then
if c>b then
writeln('segundo',c);
if b>a then
writeln('Tercero ',b);
if b>a then
writeln('Cuarto ',a);
end.


{ if b>a then
if b>c then
if b>d then
writeln('Mayor ',b);
if a>c then
if a>d then
writeln('Segundo ',a);
if c>d then
writeln('Tercero ',c);
if d>c then
writeln('Cuarto ',d);
if c>a then
if c>b then
if c>d then
writeln('Primero ',c);
if a>b then
if a>d then
writeln('Segundo ',a);
if b>d then
writeln('Tercero ',b);
if d>b then
writeln('Cuarto ',d);
if d>a then
if d>b then
if d>c then
writeln('Primero ',d);
if a>c then
if a>b then
writeln('Segundo ',a);
if b>c then
writeln('Tercero ',b);
if c>b then
writeln('Cuarto ',c);
end. }
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar