We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

usage of 'perl -le' in for loop

spandana_b
spandana_b asked
on
Medium Priority
791 Views
Last Modified: 2013-12-26
I wanted to know what is "perl -le" in the below for loop :

for i in `perl -le 'for(1..10) {print}'`
do
echo $i
done

It would be good if a detailed explanation is given.
Comment
Watch Question

CERTIFIED EXPERT
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Thanks for that.
I want to know on more thing can any command be given in place of print?

rgds.
CERTIFIED EXPERT
Top Expert 2007
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
You can call other unix commands in perl like so:

perl -le '$blah=`echo "why use Perl"`;print $blah'
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.