Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
the only thing i can say is that your (sligthly modified) demo
use strict; use warnings; use Config; print STDERR qq!Perl $^V on $^O arch $Config{archname}\n!; sub demo { my ($s1, $s2) = ('',''); my $sFormat = "s1='%s' s2='%s'\n"; open(my $fh1, '>', \$s1) or die "Can't open fh1"; print $fh1 'Hi Thing One'; printf STDERR $sFormat, $s1, $s2; # => s1='Hi Thing One' s2='' open(my $fhSave, '>&', $fh1) or die "Can't save fh1"; close $fh1; open($fh1, '>', \$s2) or die "Can't redirect fh1"; print $fh1 'Hi Thing Two*Bye Thing Two'; printf STDERR $sFormat, $s1, $s2; # => s1='Hi Thing One' s2='Hi Thing Two*Bye Thing Two' # PICK ONE OF TWO OPEN OPTIONS BELOW #1# #print STDERR "Option 1\n"; open($fh1, '>&', $fhSave) + or die "Can't restore fh1"; #2# #print STDERR "Option 2\n";open($fh1, '>', \ substr($s1, length($s1) +) ) or die "Can't restore fh1"; print $fh1 '*Bye Thing One'; printf STDERR $sFormat, $s1, $s2; # OUTPUT FROM OPEN OPTIONS #1# => s1='Hi Thing One' s2='Hi Thing Two*Bye Thing Two' #2# => s1='Hi Thing One*Bye Thing One' s2='Hi Thing Two*Bye Thing Tw +o' } demo(); exit(0);
will output your same output in modern Strwaberry release,
#option 1 ----------------------------------------······· | Perl v5.14.2 on MSWin32 arch MSWin32-x86-multi-thread | s1='Hi Thing One' s2='' | s1='Hi Thing One' s2='Hi Thing Two*Bye Thing Two' | Option 1 | s1='Hi Thing One' s2='Hi Thing Two*Bye Thing Two' -------------------------------------------------------------------- +---······· [OK] C:\ulisse\strawberry\perl\bin\perl.exe ----------------------------------------······· | Perl v5.20.0 on MSWin32 arch MSWin32-x86-multi-thread-64int | s1='Hi Thing One' s2='' | s1='Hi Thing One' s2='Hi Thing Two*Bye Thing Two' | Option 1 | s1='Hi Thing One' s2='Hi Thing Two*Bye Thing Two' -------------------------------------------------------------------- +---······· [OK] C:\ulisse\straw5.20-32b\perl\bin\perl.exe ----------------------------------------······· | Perl v5.16.2 on MSWin32 arch MSWin32-x64-multi-thread | s1='Hi Thing One' s2='' | s1='Hi Thing One' s2='Hi Thing Two*Bye Thing Two' | Option 1 | s1='Hi Thing One' s2='Hi Thing Two*Bye Thing Two' -------------------------------------------------------------------- +---······· [OK] C:\ulisse\straw64\perl\bin\perl.exe #option 2 ----------------------------------------······· | Perl v5.14.2 on MSWin32 arch MSWin32-x86-multi-thread | s1='Hi Thing One' s2='' | s1='Hi Thing One' s2='Hi Thing Two*Bye Thing Two' | Option 2 | s1='Hi Thing One*Bye Thing One' s2='Hi Thing Two*Bye Thing Two' -------------------------------------------------------------------- +---······· [OK] C:\ulisse\strawberry\perl\bin\perl.exe ----------------------------------------······· | Perl v5.20.0 on MSWin32 arch MSWin32-x86-multi-thread-64int | s1='Hi Thing One' s2='' | s1='Hi Thing One' s2='Hi Thing Two*Bye Thing Two' | Option 2 | s1='Hi Thing One*Bye Thing One' s2='Hi Thing Two*Bye Thing Two' -------------------------------------------------------------------- +---······· [OK] C:\ulisse\straw5.20-32b\perl\bin\perl.exe ----------------------------------------······· | Perl v5.16.2 on MSWin32 arch MSWin32-x64-multi-thread | s1='Hi Thing One' s2='' | s1='Hi Thing One' s2='Hi Thing Two*Bye Thing Two' | Option 2 | s1='Hi Thing One*Bye Thing One' s2='Hi Thing Two*Bye Thing Two' -------------------------------------------------------------------- +---·······
but never print '*Bye Thing One' in a old 5.8 release:
option 1 perl c:\ulisse\elisheva-demo01.pl Pe on MSWin32 arch MSWin32-x86-multi-thread s1='Hi Thing One' s2='' s1='Hi Thing One' s2='Hi Thing Two*Bye Thing Two' Option 1 s1='Hi Thing One' s2='Hi Thing Two*Bye Thing Two' >echo option 2 option 2 >perl c:\ulisse\elisheva-demo01.pl Pe on MSWin32 arch MSWin32-x86-multi-thread s1='Hi Thing One' s2='' s1='Hi Thing One' s2='Hi Thing Two*Bye Thing Two' Option 2 s1='Hi Thing One' s2='Hi Thing Two*Bye Thing Two' >perl -v This is perl, v5.8.8 built for MSWin32-x86-multi-thread


L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

In reply to Re: Redirecting/Restoring of Memory Files by Discipulus
in thread Redirecting/Restoring of Memory Files by ELISHEVA

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 15:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found