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 8258703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:38:08+00:00 2026-06-08T02:38:08+00:00

Im trying to surround all values in my hash with single quotes. here is

  • 0

Im trying to surround all values in my hash with single quotes. here is my code.

    foreach(values(%properties_hash))
    {
            print "'".$_."'\n";
    }

Right now I’m printing. How would I actually augment the value. Also this prints

'logs
'format/systemout-2010-format.txt
'analyze

It is only
printing the first ‘. Why would that be?

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-08T02:38:10+00:00Added an answer on June 8, 2026 at 2:38 am

    Your code is working.

    my %h = (
            'a' => 1,
            'b' => 2,
            'c' => 3,
            'd' => 4,
    );
    
    foreach(values(%h)) {
            print "'".$_."'\n";
    }
    

    prints

    '3'
    '1'
    '2'
    '4'
    

    Your strings are probably ended with “\r”, so the ending “‘” is printed over 1 st “‘” and therefore don’t see the last apostrophe. try:

    foreach(values(%h)) {
            s/[\r\n]//g;
            print "'".$_."'\n";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to get this right for the last 3 days now... All
im trying to surround my code with exceptions all over so I wont have
I'm trying to create two a regex to add quotes to some values in
I am trying to write a replacement regular expression to surround all words in
I am trying to create a surround-with template with resharper that formats a selection
Trying to copy the msdn refernce here doesn't work and gives an error I
I am trying in Java to surround a word in HTML with some markup.
Example: http://jsfiddle.net/xUrDc/ I'm trying to surround each li with a border exactly one pixel
I am trying to write a program that scans the surround WiFi networks and
I'm trying to map the keys ALT+SHIFT+W to surround the text/line with <p></p> tags.

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.