Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: how many lines returned from backticks

by Aristotle (Chancellor)
on Jun 30, 2002 at 10:33 UTC ( #178348=note: print w/replies, xml ) Need Help??

in reply to how many lines returned from backticks

If the program returned 5 lines the first time, and only 2 the next, won't there be lines left over from the first time?

Actually, despite what others here may have said, you do not have to worry about anything. Unlike traditional languages, an array in Perl is not just a name for a series of consecutive memory addresses (just like scalars are not just names for single memory addresses); it is a smart data type (again, scalars are too) which may grow and shrink, moving about in memory as circumstances demand etc. It does what traditional languages require you to implement linked lists for, and more.

The whole point of this explanation:
my @a=(1,2,3,4,5); @a=(1,2,3); print "@a\n"; =output 1 2 3
Perl does the nitty gritty of keeping things clean for you. Garbage collection, undef, references being smart unlike pointers, and so and so forth..

Makeshifts last the longest.

Replies are listed 'Best First'.
Re: Re: how many lines returned from backticks
by jdpindynet (Initiate) on Jul 02, 2002 at 22:48 UTC
    Many thanks to all who answered, especially Aristotle.

    The knave has now lost one measure of knaveness, thanks to the wisdom of the monks.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://178348]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2018-06-18 20:22 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (110 votes). Check out past polls.