Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I inhereted this piece of code:

my ($ids); $ids = selected_ids($c); my ($cnt) = scalar @{$ids}; my @xoffset = (800,20,20,20,20); my @yoffset = (800,500,500,500,500); if ($OS_TYPE eq 'mswin32') { # Win32 if ($cnt>=1 && $cnt <=25): {launch_bd('glimmer.exe',: 'glimmer ' . join(' ', @{$ids}[(1..$cnt)]));
The code is on a win32 sysytem and works great at passing some parameters to and launching an executable.

I tried to add one more parameter to pass by putting a comma after the "]" and add this :

$xoffset[0],$yoffset[0]));
no luck
any help would be great.

Thanks,
Mark

Edit by tye, add CODE tags, formatting

Replies are listed 'Best First'.
Re: passing array values
by shenme (Priest) on Aug 11, 2003 at 08:34 UTC
    Is it possible you already had 24 or 25 values in @{$cnt} and are now violating whatever the range check $cnt <= 25 was checking against? And would the program 'glimmer' know what you wanted to do with the added arguments? That is, how would it 'know' what " 800 800" meant? (You might want to check how to tell the program to use a new 'xoffset' value, if it can)

    --
    I'm a pessimist about probabilities; I'm an optimist about possibilities.
    Lewis Mumford

Re: passing array values
by NetWallah (Canon) on Aug 11, 2003 at 18:02 UTC
    "no luck"

    Are you getting a Compile error, or are the values not showing up at run-time ?

    The syntax seems to be fine.

    Also need to see the starting code of sub launch_bd{ in order to diagnose whether that is ignoring extra passed values.