Madhu Reddy wrote:

Hi,
  How to create data structures in perl ?
I have following data structure in C...and i have to
create similar data structure in perl and use...

how to create data strutures in perl and how to use ?


perldoc -f pack perldoc -f unpack




typedef struct { char Prefix[8]; char Print; char Name[80]; char ModTime[32]; int Len; } fileinfo_;


Eg. #!/usr/bin/perl use strict; use warnings;

my $format = 'Z8 c Z80 Z32 i';
my $fileinfo_instance = pack ($format, 'project_', 1, 'SomeName', 'ModTime', 40);
my ($prefix, $print, $name, $modtime, $length) = unpack ($format, $fileinfo_instance);


print "Prefix  = $prefix\n";
print "Print   = $print\n";
print "Name    = $name\n";
print "Modtime = $modtime\n";
print "Length  = $length\n";


Thanks -Madhu


__________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com






-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to