On Fri, Nov 2, 2012 at 2:39 PM, Dave Horner <d...@thehorners.com> wrote: > Hello, > > I found this address from the following: > http://vlsicad.ucsd.edu/Resources/SoftwareLinks/ActivePerl/Perl-Win32/perlwin32faq12.html > > I am looking for guidance on how to use Win32::OLE qw(in) on multiple > platforms. > It works fine on windows, but on other platforms, I'd like the code to > not be used. > > I tried using tricks like: > > eval 'require Win32::OLE qw( in )'; > if ($@) { > > But I am still getting: > Array found where operator expected at myscript.pm line 1693, at end of line > (Do you need to predeclare in?) > > Which is coming from the line: > my @drivelist=$objnet->EnumNetworkDrives(); > foreach my $value (in @drivelist) { > > inside of the if ($@) { block, which I was hoping wouldn't be compiled > and checked on non-win32 platforms. > > Any suggestions on how I go about defining in or properly > conditionally including Win32::OLE and it's in definition.
You need to make sure that the Perl compiler understands that 'in' is a function and not a bareword. You can do this by either adding this line to your file (before you make any calls to 'in'): sub in; Or you can write all calls to in() with parenthesis: foreach my $value (in(@drivelist)) { Cheers, -Jan _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs