Re: scalar to array?
monkeys paw <user@xxxxxxxxxxx> wrote:
What is the easiest way to push a scalar variable containing text into
an array?
That is a SAQ: perldoc -f push
i.e.
$text = 'here is
a line
that has
four lines';
@lines = ???
the end result is:
@lines =('here is', 'a line', 'that has', 'four lines');
But this has nothing to do with pushing a single scalar into an array as you
asked for at the beginning.
Just split// the text at newline and then push() or splice() the new
elements into the array. Or you could use an array slice instead, too.
jue
.
Relevant Pages
- Re: Queue question wih dyn mem alloc
... I wrote two functions to pusha character array onto an array and ... the push function seems to work well but i have ... carrying character arrays. ... Did you mean to use curlen-1 here? ... (comp.lang.c) - Re: Array of Array
... What is possible, however, is an array of array ... create a reference to an anonymous array. ... You need to push a *reference* to @tmp, ... perldoc perlreftut ... (perl.beginners) - Re: Queue question wih dyn mem alloc
... I wrote two functions to pusha character array onto an array and ... the push function seems to work well but i have ... carrying character arrays. ... that's what i thought as well but if I make curlen-1 i always ... (comp.lang.c) - Re: Queue question wih dyn mem alloc
... I wrote two functions to pusha character array onto an array and ... the push function seems to work well but i have ... carrying character arrays. ... Every pointer that contains the address of reallocated ... (comp.lang.c) - Re: The prodigal son returns...more easy Homework Help...
... Looking at your output, you're obviously "running off the end" of the "lower" array, and printing one number from the "higher" array. ... to push and pop 16 bit values as long as the stack remain aligned ... There may be other places where you want to change from 16-bit registers to 32-bit registers, ... It "sounds logical" that 16-bit calculations would be faster and "easier for the CPU". ... (alt.lang.asm) |
|