in reply to Using variables, arrays etc from a perl module in main script.
xyz.pm#!/usr/bin/perl use strict; use warnings; use xyz qw(:DEFAULT @array); print "@array\n"; sub1("Hello!");
package xyz; use strict; use warnings; require 5.008; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(sub1); our @EXPORT_OK = qw(@array); open my $fh, '<', "qwerty.txt" or die "Cannot open file: ($!)"; our @array = <$fh>; sub sub1 { my $text = shift; print "Text: $text\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using variables, arrays etc from a perl module in main script.
by kennethk (Abbot) on May 12, 2010 at 19:17 UTC | |
by walkingthecow (Friar) on May 12, 2010 at 19:40 UTC | |
by kennethk (Abbot) on May 12, 2010 at 19:46 UTC | |
by Anonymous Monk on Feb 27, 2014 at 05:19 UTC |