I'm not familiar with perl and am trying to edit an irssi translation script. The result from a web request returns as:
$result = {
"data" => {
"translations" => [
{
"translatedText" => "Halloween"
}
]
}
}
How can I fetch only the translatedText portion, so that
$string = 'Halloween'
Thanks.
"Halloween" could be obtained as:
The arrows after the first one can be omitted, so an even shorter variant would be:
Basically you have multiple indirections at different levels:
That would be
$result
is a hash ref. The key 'data' points at yet another hash ref, which has a key 'translations' pointing at an array ref. The first and only element in that array ref has a key 'translatedText' which points at the data of interest: 'Halloween'.