in reply to no strict "refs" and require

Have you looked at do?

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Replies are listed 'Best First'.
Re: Re: no strict "refs" and require
by little (Curate) on Feb 13, 2002 at 14:29 UTC
    Erm, could you elaborate on that?

    Have a nice day
    All decision is left to your taste
      do is, essentially, a file-slup + eval all in one. Try the following:
      data.txt -------- $foo = "Hello, World"; data.pl ------- #!/usr/local/bin/perl use 5.6.0; use strict; our $foo; do 'data.txt'; print $foo, $/; __END__
      Note that this will only work with non-lexical variables. If you change to my $foo;, this will not work, due to the lexical scoping of my. Before 5.6.0, this trick is accomplished with use vars qw/$foo/; instead of our $foo;

      ------
      We are the carpenters and bricklayers of the Information Age.

      Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.