in reply to Re^5: Modification of a read-only value attempted
in thread Modification of a read-only value attempted

There are entries that $response$i$j{creden} don't have following {uName}; hence i am getting the error. I would like to check if $response$i$j{creden} key having the value {uName}; or not to verify a check before assign the value to a new variable. Any help is appriciated.

  • Comment on Re^6: Modification of a read-only value attempted

Replies are listed 'Best First'.
Re^7: Modification of a read-only value attempted
by LanX (Saint) on Feb 01, 2021 at 22:14 UTC
    exists is your friend.

    you need to test for existence of both {creden} and {creden}{uName} in an if condition

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      The "creden" value is null like the following "creden": null, and other one is the following "creden": { "uName": "5xxxxxxx" }, set the below condition for them and it works!

      if ($response[$i][$j]{creden} ne "" ) { $responsuname = $responsetextall[$i][$j]{creden}{uName +}; } else { $responsuname = "No UNAME"; }