Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: strict

by autark (Friar)
on Nov 22, 2000 at 16:20 UTC ( #42907=note: print w/replies, xml ) Need Help??


in reply to strict

First, it is not use strict; which enables these warnings, but rather -w. Anyway, I agree with your theory that it must be the print statements trying to use variables without values.

There are a couple of things you should be aware of in this code. First, you try to print out all the values each time you have read a line from the file. This will of course generate warnings about the use of uninitialized values.

Second, you should probabely use a datastructure to hold your data. As it stands now, you will only get the last record of data, and it will not be correct. It will probabely contain data from earlier records.

A reasonable datastructure to use in this case might possibly be to use a hash of hashes

%data = (user1 => { "User-Service" => "Framed-User", "Framed-Protocoll" => "PPP", # etc... }, user2 => { ... } );
Autark.

Replies are listed 'Best First'.
Re: Re: strict
by toadi (Chaplain) on Nov 22, 2000 at 17:14 UTC
    yes that was the idea ... This maybe solves the problem.
    See I program bit by bit try to do one thing then add a next one if the first one worked.

    I will pump it in a hash, but then still the problem comes up. I THINK :)

    My opinions may have changed,
    but not the fact that I am right

      When you use a hash, you can assign values to keys,
      if there is no value, there is no key, then you can just
      print out all the keys

      And else you just check if the values are defined before
      printing/doing something with them

      GreetZ!,
        ChOas

      I didn't know my example was THAT bad

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2020-12-01 15:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (10 votes). Check out past polls.

    Notices?