Variable showing up as blank in Format output. Stumped...

Z

Zeheeba

Hello Everyone.
I have a format that is outputting a variable as empty spaces. I have
no clue why its doing this.

The variable causing problems is listed below:

$revzone="$last.$net.1.10.in-addr.arpa";

If I put the print command after this declaration I get

43.15.1.10.in-addr.arpa

The problem occurs when I place it in the following format:
___________________________________________________________
format DEFAULTREV =
server 10.1.99.20
zone @<.1.10.IN-ADDR.ARPA
$ip
update add @<<<<<<<<<<<<< 10800 PTR @>>>>>>>>>>>>.domain.com."
$revzone, $host
show
send
..
____________________________________________________________

The first variable space after "update add" has 25 <'s in it, I
truncated it due to the line wrapping.

After outputting this format to a file, it looks like this:
_____________________________________________________________
server 10.1.99.20
zone 15.1.10.IN-ADDR.ARPA
update add 10800 PTR name.domain.com.
show
send
..
_____________________________________________________________

Does anyone know why a blank space would be left instead of the
variable? I have never had this problem with formats before.
Any help is appreciated.

Regards,
Daniel
 
Z

Zeheeba

I apologize for not giving details. Here they are before they are
asked for...

Perl version: 5.6.0-17
OS - Yellow Dog Linux 3.0
 
A

Anno Siegel

Zeheeba said:
Hello Everyone.
I have a format that is outputting a variable as empty spaces. I have
no clue why its doing this.

The variable causing problems is listed below:

$revzone="$last.$net.1.10.in-addr.arpa";

If I put the print command after this declaration I get

43.15.1.10.in-addr.arpa

The problem occurs when I place it in the following format:
___________________________________________________________
format DEFAULTREV =
server 10.1.99.20
zone @<.1.10.IN-ADDR.ARPA
$ip
update add @<<<<<<<<<<<<< 10800 PTR @>>>>>>>>>>>>.domain.com."
$revzone, $host
show
send
.
____________________________________________________________

The first variable space after "update add" has 25 <'s in it, I
truncated it due to the line wrapping.

After outputting this format to a file, it looks like this:
_____________________________________________________________
server 10.1.99.20
zone 15.1.10.IN-ADDR.ARPA
update add 10800 PTR name.domain.com.
show
send
.
_____________________________________________________________

Does anyone know why a blank space would be left instead of the
variable? I have never had this problem with formats before.
Any help is appreciated.

Presumably one or the other of the variables used is not defined
when write is called. You don't show that, so we can only guess.

Run your code under strict and warnings and follow the hints.

Anno
 
Z

zeheeba

Problem solved, thanks for your help Anno. I shouldn't work on scripts
so late at night. The variable $revzone was being declared after the
format was being written, no wonder it wouldn't work.

Thanks again.

Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top