For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > October 2006 > Re: Prefix printed lines on screen with a line number. Need advice.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Prefix printed lines on screen with a line number. Need advice.
nobull67@gmail.com

2006-10-01, 6:58 pm

Jay wrote:

> foreach $var1 {


I have no idea what you think that's supposed to do.

for (also known as foreach) has a syntax like this...

for VAR ( LIST ) { BLOCK }

You've not supplied a LIST for $var1 to iterate over.

> printf "%4d: ", $var1, "\n";


You are providing a format that expects one value, then you provide two.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com