Hi Anjan You can execute shell command inside "``" and capture the output in variable . e,g: -------------- $, = " "; $ls = `ls`; print $ls; @ls = split(/\n/,$ls); print @ls; ------------------
Thanks Sunita -----Original Message----- From: ANJAN PURKAYASTHA [mailto:anjan.purkayas...@gmail.com] Sent: Tuesday, April 05, 2011 6:54 PM To: Perl Beginners Subject: Capturing the output of a shell command Hi, Is there any way to run a shell command from within a perl script and capture the output in, say, an array? One can run a shell command through the system function. But system itself just returns a status code. -- =================================== Anjan Purkayastha, PhD Senior Computational Biologist TessArae LLC 46090 Lake Center Plaza, Suite 304 Potomac Falls, VA 20165** Office- 703.444.7188 ext. 116 Mobile-703.740.6939 =================================== -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/