[Omaha.pm] C++ questions (kidding)
Andy Lester
andy at petdance.com
Sun Jul 2 21:11:43 PDT 2006
On Jul 2, 2006, at 11:06 PM, griffinheart at 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 at petdance.com => www.petdance.com => AIM:petdance
More information about the Omaha-pm
mailing list