NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
NOTE: The decoders
mailing list is no longer active. The list archives are made available for historical reasons.
On Mon, 22 Nov 1999, Steve Diggs wrote:
Robb, This is a 'quick-hack' subroutine to take those arrays of short integers that used to be string arrays in netCDF into a Perl array of strings. No error checking (which could be added). Let me know if you find this tool useful.
Steve, It's a good idea to use pack, but I think the return should of been of type string not array. The reason is perl uses string vs array. It wouldn't be hard to change. Good idea though. Robb...
-sd -- -------------------------------------------------------------------- Steve Diggs Voice: (858)534-1108 Scripps Institution of Oceanography FAX : (858)534-7383 WOCE Hydrographic Program Office/STS EMAIL: sdiggs@xxxxxxxx 9500 Gilman Drive WWW : whpo.ucsd.edu La Jolla, CA 92093-0214 -------------------------------------------------------------------- # #--> This subroutine will take in a null padded array of numerical #--> CHARS into an array of strings. Takes the array as input, output #--> in an array of strings. # #--> S. Diggs: 1999.11.22 # sub num_to_string_array { my $string_sect = pack('C*', @_); my @new_dum = split /\000+/,$string_sect; my @return_array = @new_dum; } 1;
============================================================================== Robb Kambic Unidata Program Center Software Engineer III Univ. Corp for Atmospheric Research rkambic@xxxxxxxxxxxxxxxx WWW: http://www.unidata.ucar.edu/ ==============================================================================
decoders
archives: