1- Thanks for posting with a descriptive subjects:) 2- $_ is the default perl variable, when you don't specify one and you cann a while, foreach, etc, it has that variable in the $_. Right after declaring a variable, $_ stores that variable.
the best if you don't want to play with $_ yet, declare a variable to hold the data you should always add use strict; to the top of you script, therefore you will have to declare @words using my print "please enter a word\n"; #neter is not english :) chomp (my @words = <STDIN>); foreach my $oneword (@words){ printf "%20s\n", $oneword; #puts each value of the @word in $oneword. } (untested) HTH, Etienne [EMAIL PROTECTED] wrote: > > Hi, > > I am very new to PERL (as you will be able to tell!!!), can you please > explain my question below? > > When I run this piece of code (below) I am looking for more than one word > to be etered by the user and then the words that were entered are returned > to the user in a right justified 20 character column. However only the > first word I enter is returned when @words is used (where marked in bold) > but the $_ variable works correctly. > > Can you please tell me what the difference is and how does it work? > > > Thanks > Brian > > >************************************************************************************************** > The contents of this email and any attachments are confidential. > It is intended for the named recipient(s) only. > If you have received this email in error please notify the system manager or the > sender immediately and do not disclose the contents to any one or make copies. > > ** eSafe scanned this email for viruses, vandals and malicious content ** > >************************************************************************************************** > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- Etienne Marcotte Specifications Management - Quality Control Imperial Tobacco Ltd. - Montreal (Qc) Canada 514.932.6161 x.4001 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]