[Vienna-pm] use strict => Geltungsbereich?

Thomas Klausner domm at zsi.at
Fri Mar 28 06:02:15 CST 2003


Hi!

On Fri, Mar 28, 2003 at 12:54:49PM +0100, Baier Oliver INT SD wrote:

> habe mit Namespaces bzw. Packages bisher noch nichts zu tun
> gehabt und stehe nun vor einem kleinen Problem.
> .. 

> => In welchem Geltungsbereich befinde ich mich nach "use strict"

wenn du mit 
package SomeNameSpace;
einen Namespace definiert hast, in jeweiligen Namespace. Sonst in main.

> use strict;
> 
> if (defined @ARGV && $ARGV[0] eq '-c') {
>     $::db_count = 0;
>     ...
>     ...
> }
> 
> print "passt\n" if defined $db_count;

print "so passts\n" if defined $::db_count;

Andere Moeglichkeiten waere zB

use vars qw($db_count);   # siehe perldoc vars

also:

use strict;
use vars qw($db_count);
if (defined @ARGV && $ARGV[0] eq '-c') {
    $db_count = 0;
    }
    
    print "passt\n" if defined $db_count;


-- 
#!/usr/bin/perl                               http://domm.zsi.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}



More information about the Vienna-pm mailing list