Programming Wiki: Structures with arrays in perl

Programming Wiki : PerlStructures

WikiHomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
Most recent edit on 2006-04-16 21:41:34 by ScottRippee

Additions:

Structures with arrays in perl



Deletions:

Structures in perl





Edited on 2006-04-16 20:19:13 by ScottRippee

Additions:

Structures in perl

Perl



Deletions:

Perl

Structures in perl





Edited on 2006-01-06 23:03:05 by ScottRippee

No differences.


Edited on 2006-01-06 23:02:56 by ScottRippee

No differences.


Edited on 2006-01-06 22:59:32 by ScottRippee [Created initial page]

Additions:

Structures in perl


Creating A Structure


struct (ThisStructure =>
[
       my_var => '$',
       my_array => '@',
]);



Adding stuff into our structre
   #Populate an array with information from a file
   #reads in each line of a text file into an array "file_stuff"
   open(FILE,"./my_text_file"); my @file_stuff = <FILE>; close FILE;


   my $foo = ThisStructure->new( my_var       => 'some text',
                                         my_array => [@$file_stuff],
                                            );



Accessing (print) the array in the structure
    print @{$foo->my_array};

This syntax looked strange at first but works.


Deletions:

Perl Structures





Oldest known version of this page was edited on 2006-01-06 22:43:20 by ScottRippee []
Page view:

Perl

Perl Structures

Powered by Wikka Wakka Wiki 1.1.6.0
Page was generated in 0.0265 seconds