Hmm, It works, I'll give you that. I'm still confused as to why it locks up on my version though. Take a look at this code (I was experementing and benchmarking at the same time):

#!/usr/bin/perl -w use strict; use IO::File; use GMS; require "GMSConstant.pl"; use Benchmark qw(cmpthese); my $t1 = '1'; my $t2 = '2'; my $t3 = '3'; my $GMS = new GMS; my $sitename = $GMS->getsetting('GUILD','SITENAMET'); my($name,$email,$icq) = ('Iron','flame@berkshire.rr.com','16307443'); my @stats = (100,100,25); my $skills = [ {'SKILL' => 'Anatomy','VALUE' => 100}, {'SKILL' => 'Swordsmanship','VALUE' => 100}, {'SKILL' => 'Tactics','VALUE' => 100} ]; my $onotes = "This is a long test string.\n\n" x 30; my $notes; sub otherway{ $notes = $onotes; #Re-Initialize variable since it was wiped out by + the write() my $fh = IO::File->new_tmpfile() or die $!; $fh->format_name('GMMAIL'); #This one works regardless of which format it's attached to. select($fh); write(); seek($fh, 0, 0); # Rewind the file my $str = do {local $/; <$fh>}; select(STDOUT); print $str; } sub myway{ $notes = $onotes; #Re-Initialize variable since it was wiped out by + the write() pipe(TESTOUT,TEST) or die($!); select(TEST); $~='GMMAIL'; #Note THIS Line: When set to 'TEST' everything's fine... #however, when set to GMMAIL like this, it locks up. #What's the difference that causes it to work for one but #not the other? $|=1; write(); close(TEST); select(STDOUT); my @temp = <TESTOUT>; print join('',@temp); close(TESTOUT); } cmpthese(10000,{ 'Suggestion' => \&otherway, 'MyTest' => \&myway} ); format TEST= @||| @||| @||| $t1,$t2,$t3 @||| @||| @||| $t3,$t2,$t1 . format GMMAIL= @||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +||||||||| "$sitename - Application" Name: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | Notes: ^<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $name, $notes E-Mail: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<< | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $email, $notes ICQ: @<<<<<<<<<< | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $icq, $notes ---------------------------------------| ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $notes /------\ | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $notes | Stats | | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $notes |--------| | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $notes |@<<: @>>| | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $GMS::Constant::STATS[0],$stats[0], $notes |@<<: @>>| | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $GMS::Constant::STATS[1],$stats[1], $notes |@<<: @>>| | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $GMS::Constant::STATS[2],$stats[2], $notes \------/ | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $notes ---------------------------------------| ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $notes | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $notes Skills | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $notes ------ | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $notes @<<<<<<<<<<<<<: @###.# | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $skills->[0]->{'SKILL'},$skills->[0]->{'VALUE'}, $notes @<<<<<<<<<<<<<: @###.# | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $skills->[1]->{'SKILL'},$skills->[1]->{'VALUE'}, $notes @<<<<<<<<<<<<<: @###.# | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $skills->[2]->{'SKILL'},$skills->[2]->{'VALUE'}, $notes ~~ | ^<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<< $notes @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +>>>>>>>>> $GMS->getsetting('FILE','CGIBINS').'/join.c +gi?admin' .


The comments inside the tested subs should explain my current question well enough.

FYI: It appears that when it actually works, my way is faster by about 3%. But I suppose regardless of what's faster, I have to use what works... heh.

Thanks for the suggestion.



"Weird things happen, get used to it."

Flame ~ Lead Programmer: GMS


In reply to Re: Re: format and IO::String by Flame
in thread format and IO::String by Flame

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.