in reply to build array of geometry data
I don't know renderman, so i am not sure how complex this is going to grow to, but i think the following will do something similar to what you are asking about : lightly-tested code ahead
#!/usr/bin/perl my $string; { $/ = undef; $string = <DATA>; } while ($string =~ m!\[\s*([^]]+)\]!g) { my @nums = split(/\s+/,$1); print "Array : ",join(',',@nums),"\n"; } __DATA__ [1 1 1 1 1 1 ][4 4 4 4 4 4] [ 123 123 123 123 123 123 123 123 123 ] "P" [ -1 1 1 1 1 -1 1 1 1 ]
If renderman has a very complex file format, you may want to write a more robust parser.
from the frivolous to the serious
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: build array of geometry data
by Frippe (Acolyte) on Feb 10, 2003 at 15:45 UTC | |
by MZSanford (Curate) on Feb 10, 2003 at 16:17 UTC | |
by Frippe (Acolyte) on Feb 10, 2003 at 19:37 UTC | |
by CharlesClarkson (Curate) on Feb 11, 2003 at 06:50 UTC | |
by Frippe (Acolyte) on Feb 10, 2003 at 19:55 UTC |
In Section
Seekers of Perl Wisdom