Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8908707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:15:06+00:00 2026-06-15T03:15:06+00:00

Simple question: I want to write a function like say . But it had

  • 0

Simple question:

I want to write a function like say.

But it had one bad feature: a filehandle.

       say FILEHANDLE LIST
       say FILEHANDLE
       say LIST
       say 

How to declare it? Is it possible?

P.S:
I find an example with myopen(*;$), but it’s not the same thing.
P.P.S:
I need this function in old Perl versions, because it is annoying to write print "\n"

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:15:07+00:00Added an answer on June 15, 2026 at 3:15 am

    Perl6::Say does just that.

    It cleverly emulates the say FILEHANDLE TEXT syntax by taking advantage of Perl’s usually very annoying indirect method call syntax. It loads IO::Handle turning every filehandle into an object and creates IO::Handle->say. Now say FILEHANDLE TEXT is actually FILEHANDLE->say(TEXT).

    It does have caveats. From the docs…

    Use it just like print (except that it only supports the indirect
    object syntax when the stream is a bareword). That is, assuming
    the relevant filehandles are open for output, you can use any of these:
    
    say @data;
    say FH @data;
    FH->say(@data);
    *FH->say(@data);
    (\*FH)->say(@data);
    say $fh, @data;
    $fh->say(@data);
    
    but not any of these:
    
    say {FH} @data;
    say {*FH} @data;
    say {\*FH} @data;
    say $fh @data;
    say {$fh} @data;
    

    UPDATE: To make this even simpler, I have just uploaded Say::Compat which loads either Perl6::Say or use feature 'say' depending on your version of Perl.

    That’s the best you’re likely to get without playing with Devel::Declare.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple question I guess, I want to use PHP to write an update to
Very simple question, but I want to start using a consistent naming convention for
I feel like this is a stupid simple question, but I've been doing so
Well this is a simple question i want to filter two elements sorted reverse
Simple question, I just want to select the text from the <Template> tag. Here's
Really simple question: From within GWT I want to forward the user away from
A simple question, I think: I want to put a tag into an ASP.NET
Simple question: I am opening a file in matlab 7.x, and I want to
I have a simple question. I have a long std::string that I want to
I have what may be a very simple question. I want to process a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.