in reply to Weird array printing/passing to subroutine problem
There's a problem with your parameter passing. Within the subroutine, the parameters are recieved in the special array @_. This contains all of the parameters in one flattened list. In your case, this gives you:
$_[0] = 'blah, blah, blah'; $_[1] = 'foo, bar, diddledum'; $_[2] = 'files'txt';
When you then use shift to extract these values into local variables, it only pulls values off @_ one at a time, so you end up with
@arraytowrite = ('blah, blah, blah'); $writefile = 'foo, bar, diddledum'; $text = 'files'txt';
Which will probably explain the problem you see.
What you should be doing is either passing a reference to the array or passing the array as the last parameter and pulling the scalars off the front first.
--
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Weird array printing/passing to subroutine problem
by flyfishin (Monk) on Jul 10, 2000 at 19:21 UTC |