Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GLOB output. What does it mean?... 1

Status
Not open for further replies.

gareh

Programmer
Apr 27, 2003
4
GB
Hi,

This segment of my script:

Code:
    open($file_var, ">>../login.txt") or die "$!\n";
    printf ($file_var, "%s:%s:%s:%s:%s\n",new_username, new_password, new_group, new_shell, new_superuser);
    close($file_var) or die "$!\n";

The output on my web page is:

Code:
    GLOB(0x810c054)
What its supposed to do is append to the file, all the variables listed, seperated by a ":"

Thanks for any help

 
You are trying to print the file handler memory reference, rather than the interpolated string. Try:

printf $file_var "%s:%s:%s:%s:%s\n",new_username, new_password, new_group, new_shell, new_superuser;

Removing the comma after $file_var tells Perl you are using this as a file handle. With the comma there Perl assumes this is the format string to interpolated to the file handle STDOUT.


Barbie
Leader of Birmingham Perl Mongers
 
Thanks.. seems to be fixed now. Much appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top