What does the "useless use of a variable in a void context" mean in this Perl script?

The following script gives me what I want, but Perl also warns me: "Useless use of a variable in a void context." What does it mean?

use strict;
use warnings;

my $example = 'http\u003a//main\u002egslb\u002eku6\u002ecom/c0/q7LmJPfV4DfXeTYf/1260269522170/93456c39545857a15244971e35fba83a/1279582254980/v632/6/28/a14UAJ0CeSyi3UTEvBUyMuBxg\u002ef4v\u002chttp\u003a//main\u002egslb\u002eku6\u002ecom/c1/q7LmJPfV4DfXeTYf/1260269522170/3cb143612a0050335c0d44077a869fc0/1279582254980/v642/10/20/7xo2MJ4tTtiiTOUjEpCJaByg\u002ef4v\u002chttp\u003a//main\u002egslb\u002eku6\u002ecom/c2/q7LmJPfV4DfXeTYf/1260269522170/799955b45c8c32c955564ff9bc3259ea/1279582254980/v652/32/4/6pzkCf4iqTSUVElUA5A3PpMAoA\u002ef4v\u002chttp\u003a//main\u002egslb\u002eku6\u002ecom/c3/q7LmJPfV4DfXeTYf/1260269522170/cebbb619dc61b3eabcdb839d4c2a4402/1279582254980/v567/36/19/MBcbnWwkSJu46UoYCabpvArA\u002ef4v\u002chttp\u003a//main\u002egslb\u002eku6\u002ecom/c4/q7LmJPfV4DfXeTYf/1260269522170/1365c39355424974dbbe4ae8950f0e73/1279582254980/v575/17/15/EDczAa0GTjuhppapCLFjtaQ\u002ef4v';

my @raw_url = $example =~ m{(http\\u003a.+?f4v)}g;

my @processed_url =   map {
                             s{\\u003a}{:}g,$_; 
                             s{\\u002e}{.}g,$_;
                             s{\\u002d}{@}g,$_;
  } @raw_url;

print join("\n",@processed_url);

And why does this card not work if I omit these underscores in dollars so?

 my @processed_url =   map {
                             s{\\u003a}{:}g; 
                             s{\\u002e}{.}g;
                             s{\\u002d}{@}g;
  } @raw_url;

When I omit these underscores in dollars, I get nothing but, possibly, the success sign “1”. What am I missing? Any ideas? Thanks, as always :)

+3
source share
2 answers

What would you like...

my @processed_url =   map {
                       s{\\u003a}{:}g; 
                       s{\\u002e}{.}g;
                       s{\\u002d}{@}g;
                       $_;
} @raw_url;

A map block , , . $_ . s {} {} .

. , Perl.

s{\\u003a}{:}g, $_;
+9

, , map block: . , - , :

my @processed_url = @raw_url;
for (@processed_url) {
    s{\\u003a}{:}g;  
    s{\\u002e}{.}g; 
    s{\\u002d}{@}g;
}

, , :

for (@raw_url) {
    s{\\u003a}{:}g;  
    s{\\u002e}{.}g; 
    s{\\u002d}{@}g;
}
+5

Source: https://habr.com/ru/post/1755417/


All Articles