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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:07:16+00:00 2026-05-19T03:07:16+00:00

I cannot understand what I’m doing wrong with such a simple statement. The problem

  • 0

I cannot understand what I’m doing wrong with such a simple statement. The problem occurs on the line:

$this->_validate_hash($hashref->{$key}, $schemaref->{$key}, $path . (ref($hashref->{$key}) ? $key . "/" : "\\\@$key"), $errors);

So I want things to end with /path/to/some/\@attribute. However, what I’m getting at the moment is path/to/some/\\@attribute. I tried various combos for the last part including '\\' . '@' . $key or '\@' . $key or '\\@' . $key but I still can’t escape the backslash. Is this some quirk in perl strings that I’m not aware of? 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-05-19T03:07:17+00:00Added an answer on May 19, 2026 at 3:07 am

    That is not a simple statement; it is split over two lines and contains all sorts of stuff. This achieves the same result, as near as I can see (and assuming $xpath is not used elsewhere in your script):

    my $xpath = $path . (ref($hashref->{$key}) ? $key . "/" : "\\\@$key");
    $this->_validate_hash($hashref->{$key}, $schemaref->{$key}, $xpath, $errors);
    

    However, it is more nearly readable – still not particularly easy, but much more readable than the original.

    Your problem child can be reduced, it seems, to:

    use strict;
    use warnings;
    
    my $key  = "attribute";
    my $path = "/path/to/some/";
    my $localpath = $path . "\\\@$key";
    
    print "Key:   $key\n";
    print "Path:  $path\n";
    print "Local: $localpath\n";
    

    That code works cleanly:

    Key:   attribute
    Path:  /path/to/some/
    Local: /path/to/some/\@attribute
    

    So, either I’ve got a different Perl (this was 5.12.1 on Linux x86/64) or there is something different in your setup. Given that we don’t have all the hashes etc, it will be hard to get at it – but you should break down your problem in an analogous way.

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

Sidebar

Related Questions

I cannot understand this piece of Smalltalk code: [(line := self upTo: Character cr)
I cannot understand why my compiler (MSVC++2010) doesn't like this code: // get_sum(filename as
I'm using this jQuery form validator but I cannot understand how to make one
i found a site like graph.facebook.com but I cannot understand this API, so I
I cannot understand why my MKMapView does not want to change to satellite view.
I cannot understand the mistake. error None, but no records get inserted. nothing happens.
I'm confused - I cannot understand what is the delegate is for? The Application
IN MS SQLSERVER 2005 I cannot understand the following terms server instance
There is really something in objc I cannot understand. I know how to make

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.