Sky Blueshoes <[EMAIL PROTECTED]> wrote:  Ron Smith wrote:

>Hi all,
> 
> How would I redirect the output of the print line to an array instaed of 
> STDOUT?
> 
> my $firstBar = 5;
> print "*" while $firstBar, $firstBar--;
> 
> I've looked in several places, including the Camel Book and the Cookbook. 
> Everything seems to be refering to a filehandle instead.
> 
> ...any suggestions??
>
>
>Ron Smith
>[EMAIL PROTECTED]
> 
>
>------------------------------------------------------------------------
>
>No virus found in this incoming message.
>Checked by AVG Free Edition.
>Version: 7.1.375 / Virus Database: 267.15.6/257 - Release Date: 2/10/2006
> 
>
If you want to assign something to an array, you do just that.

@array = $firstBar;

if you want to print to a file, you need to open a filehandle

open (FILE, "firstbar.txt");

and then print to it:

print FILE "*" while $firstBar, $firstBar--;

-- 
SkyBlueshoes
http://skyblue.fulllifeministries.org
[EMAIL PROTECTED]

Intel Pentium D 920 2.8Ghz w/ 1GB PC4200 DDR2 SDRAM
Maxtor 114GB & Maxtor 150GB
HP dvd635 DVD combo recorder
XFX GeForce 7800GT overclocked w/ 256 DDR3
Intel 945p chipset w/ 8ch Audio
Microsoft Windows XP Professional (Service Pack 2)


  Yes, you are right. I probably should post the rest of the story at this 
point:
   
  I'm taking numerical values from a web page:
   
  my $firstBar = param( "textfield" );
   
  and I'd like to generate a row of asterisks, based on the number stored in 
$firstBar. I thought of printing to a file then splitting the contents to an 
array, but I was wondering if there was a more direct way.


Ron Smith
[EMAIL PROTECTED]

Reply via email to