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

  • Home
  • SEARCH
  • 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 4608472
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:50:59+00:00 2026-05-22T00:50:59+00:00

when attempting to print object as in: print $response{_content} \n; printf OUTPUT $response{_content} \n;

  • 0

when attempting to print object as in:

print "$response{_content} \n";
printf OUTPUT "$response{_content} \n"; 

The printf statement generates error “Modification of a read-only value attempted”

It’s an intermittent error. Only happens once in a while, but this program needs to be 100% reliable. dang.

It prints fine to STDOUT.

What am I doing wrong? arrgh!

  • 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-05-22T00:51:00+00:00Added an answer on May 22, 2026 at 12:51 am

    The first argument of printf is interpreted as output format, not output itself. See perldoc -f printf and man 3 printf for details.

    The problem is, printf might occasionally try to write to its args (this has even been the source of several vulnerabilities in C programs), for instance:

    perl -we 'printf "abc%n\n", $_; print "$_\n";'
    

    As you can see, this sets $_ to 3, which is the number of characters written before %n occurred. Try %n without further args and you’ll see the exact error message from OP.

    Long story short: use print unless you really need advanced formatting. Keep first argument to printf r/o unless you really need even more advanced formatting.

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

Sidebar

Related Questions

Attempting to print out a list of values from 2 different variables that are
I am attempting to print a JPEG file that I reference using a Uri
When I print the result of the regex I am attempting to use to
I'm attempting to use Mono to load a bitmap and print it on Linux
I have the following already decoded json stored in $response = $result->response; : object(stdClass)#6
I am attempting to orbit an object around a center point, much like the
I'm attempting to use an HttpDelete object to invoke a web service's delete method.
I'm attempting to craft a function that takes a time object and converts it
Why am I getting this error, from line 5 of my code, when attempting
I'm attempting to create an html element as a jQuery object, and then reference

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.