What I'm trying to write is a script to randomly write to standard output questions in a file everytime I execute the script. I seem to be getting these errors, though and I'm just not sure what I'm doing wrong. I'm not sure what the errors are telling me.



From: "Wagner, David --- Senior Programmer Analyst --- WGO" <[EMAIL PROTECTED]>
To: 'Michael Corgan' <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
Subject: RE: How to name STDIN from the command line
Date: Thu, 23 Jan 2003 15:14:17 -0600

Michael Corgan wrote:
> I used the ARGV earlier, but received errors. So this is how the
> script looks now:
> #! /usr/local/bin/perl -w
> use strict;
> #
> #
> #
>
> $/ = "\n%\n";
>
> while (<>) {
> my $random = rand(@ARGV);
> my $question = $ARGV[$random];
> chomp $question;
> print $question;
>
> This is the error I am getting back:
>
> Use of uninitialized value at /home/mcorgan/bin/flash line 12, <>
> chunk 1. Use of uninitialized value at /home/mcorgan/bin/flash line
> 13, <> chunk 1. Use of uninitialized value at /home/mcorgan/bin/flash
> line 12, <> chunk 2. Use of uninitialized value at
> /home/mcorgan/bin/flash line 13, <> chunk 2.
>
> Aren't I initializing the values with the "my" before the scalar
> variables?
>
>
Micheal,
Unsure what you are trying to do? You say you are picking from a
file which you are inputting via the command line. Then what? I see you
picking the the file then print the file. Is that what you want to do? The
while (<>) would read data in from one file after another until all files
are gone.

Need some other insight on what you are trying.

Wags ;)


**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to