Ok, well you're going about that all wrong.
To execute an external program and get its output into an array of lines, use qx():
@fields = qx( /opt/apache/1.3.27/cgi-bin/cspireutils/ldapsearch -h 172
+.30.58.243 -p 389 -D $dirsrv -w 'passwd' -b ou=subscribers,ou=users,o
+u=prague,ou=domains,ou=cz,ou=domains,o=chello cn=$sid dn jrMailBoxId
+jrMailboxAliasStore jrPWPUID jrPWPUserPrefs jrUserFriendlyID );
then you can easily iterate over the lines with foreach.
Alternatively, you could use the while(<>) construct to read from a pipe connected to the output of an external program:
open P, $command # as above
or die "can't run $command - $!";
while (<P>)
but note specially the use of an explicit filehandle inside the angle brackets. Omit that, and you'd be reading from stdin.
If you assign to @fields as above, you'll be overwriting the array of values you orginally assigned to it.
Is that what you intended?
A word spoken in Mind will reach its own level, in the objective world, by its own wei ght
|