[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] C++ questions (kidding)




On Jul 2, 2006, at 11:06 PM, griffinheart@go.com wrote:

I have a few questions I could use some help with:

1.  Is there a way to read in a file one character at a time (a text
file) so I could store it into an array?

You want an array of single characters? You can read it all into a string and index individual characters with the substr() function.


2.  If not, is there any way to "pop" or "shift" a scalar to remove a
character like you could to an array?

To remove the first character of a string:

$str = substr( $str, 1 );

or

$str =~ s/^.//;


3.  When you send an argument to a subroutine, is the argument
actually "sent" or is it just referenced?  (This is important due to
the size of variables I'm working with.)

Don't worry about the size of the variables. Chances that it will affect performance are small.

Andy

--
Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance