I'm trying to make a new string from array elements thus:
my $truth = "s3://dir/@d[$d1]/$plate/@d[$d1].$plate.delta";
but the issue is that this gives
s3://dir/pgr_9/1/@d[0].1.delta
when it should give
s3://dir/pgr_9/1/pgr_9.1.delta
Why isn't this array element @d[0]
interpolating into the string $truth
? How can I get it to?
Not sure about the reason (probably $plate.delta
is regarded as a method call?), but escaping the dot before delta
solves the problem.
my $plate = 1;
my $d1 = 0;
my @d;
@d[0] = "pgr_9.1";
say "s3://dir/@d[$d1]/$plate/@d[$d1].$plate\.delta";
Output:
s3://dir/pgr_9.1/1/pgr_9.1.1.delta
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With