Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Matching a variable in a fixed width file

by ozone (Friar)
on May 08, 2002 at 23:14 UTC ( #165210=note: print w/replies, xml ) Need Help??

in reply to Matching a variable in a fixed width file

Three things:
  • you say you're reading from a file, yet you're getting your input from '<>', which is stdin. that might be why you're not getting any data
  • you're using 'fixed-width' files, yet you're expecting each line to end in a newline. If 'fixed-width' == record based, then you should be doing a read($buffer, $record_length) and doing the regex on $buffer
  • the best way to pass data between subs is to pass arguments. Globals are evil (tm). The first line of get_domcf should be something like my $key = shift; and you should call get_domcf like so get_domcf($key)
I think if you sort these bits out, you'll fix your problem :-)

Replies are listed 'Best First'.
Re: Re: Matching a variable in a fixed width file
by aseidas (Beadle) on May 08, 2002 at 23:27 UTC
    In the sub get_domkey I am reading from  <STDIN> this is not a problem, I am getting the key I want (the print statement is returning it). The sub get_domcf is where I am reading from a file. I will try to get rid of the globals and see if that helps, thanks for the reply ! Aseidas

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2022-05-18 13:58 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (71 votes). Check out past polls.