Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^5: bug or curly bracket hell?

by Anonymous Monk
on Jan 13, 2023 at 20:36 UTC ( [id://11149578]=note: print w/replies, xml ) Need Help??


in reply to Re^4: bug or curly bracket hell?
in thread bug or curly bracket hell?

if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) {$VARDB_database = $line; my $VARDB_database =~ s/.*=//gi;}
With strict enabled you can't do certain things that make no sense, like declaring a variable with "my" after you already used that variable.

Replies are listed 'Best First'.
Re^6: bug or curly bracket hell?
by MoodyDreams999 (Scribe) on Jan 13, 2023 at 21:52 UTC
    Well I guess that means I will have to rewrite it all if I wanna use strict, thank you for the guidance
      To fix this line, just remove the "my" before "$VARDB_database":
      if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) ) {$VARDB_database = $line; my $VARDB_database =~ s/.*=//gi;}
      Using strict and warnings will save you from bugs like the above which fail silently:

      use strict; use warnings; #path to astguiclient configuration file: my $PATHconf = '/etc/astguiclient.conf'; my ( $PATHlogs, $VARserver_ip, $VARDB_server, $VARDB_database, $VARDB_user, $VARDB_pass, $VARDB_custom_user, $VARDB_custom_pass, $VARDB_port); # Now perl knows the variables you will use, so if there is # a typo later like "$PATHlog" instead of "$PATHlogs" then # perl will tell you how to fix it, instead of just failing # silently (like crappy PHP and Python :^) open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n"; my @conf = <conf>; close(conf); my $i=0; foreach(@conf){ my $line = $conf[$i];

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11149578]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2025-06-20 20:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.