using wildcard in Perl in dir name matching [duplicate] - perl

This question already has answers here:
using wildcard in the dir locations and find all files with an extension
(2 answers)
Closed 9 years ago.
my #hex_locations = ("$FindBin::Bin/../../../project/platform-aa-full/bb",
"$FindBin::Bin/../../../project/platform-aa-base/bb");
how do I use wild card to match any directory with project/platform-aa-* in above code?

Use glob
my #hex_locations = glob("$FindBin::Bin/../../../project/platform-aa-*/bb");

Related

Why does wrapping output in quote create extra quote after? [duplicate]

This question already has answers here:
.* matches 2 times
(2 answers)
Why do regex engines allow / automatically attempt matching at the end of the input string?
(6 answers)
Closed 6 months ago.
I want to ls -name a folder and wrap the result between the quotes`. However the result make an extra quote after.
> (ls -name) -replace '(.*)', '"$1"'
"apple"""
"orange"""
"dog"""
"cat"""
Why is that?

Concat variable's name in powershell [duplicate]

This question already has answers here:
Dynamically create variables in PowerShell
(1 answer)
Create an incrementing variable from 2 variables in PowerShell
(2 answers)
Closed 10 months ago.
I looking for this in powershell
$VAR0=args[0]
$VAR1=args[1]
$VAR2=args[2]
With a construction like this
$a=0
$VAR+$a=args[$a]
but I cannot concatenate this way

I Can't define string in dart with $ in it [duplicate]

This question already has answers here:
How do you print a dollar sign $ in Dart
(2 answers)
Closed 2 years ago.
I want to use this as String in Dart.
String s = 'reservoir$lbc_release'
Getting error due to $. How do I solve this?
Just use escape sequence
print('Hello \$');
Please use '\' in front of '$'
String s = 'reservoir\$lbc_release'

Count number of occurrence of pipe ("|") in a file with PowerShell [duplicate]

This question already has answers here:
Counting characters in a specific text file
(4 answers)
Closed 4 years ago.
I have data in a file like below.
text1|text2
text3|text4|
I'm looking for a Power Shell command to count number of pipes present in thisfile.
Normally I would want you to show some effort but this is trivial enough I won't bother:
$pipeCount = (get-content file.txt -Raw).Split('|').count - 1
$pipeCount

Grab first segment of URL in Perl [duplicate]

This question already has answers here:
How do I extract the domain out of an URL?
(2 answers)
Closed 9 years ago.
I have a URL saved to a variable in Perl and I'd like to strip off everything after the domain name. I think grabbing everything to the left of the third slash should do it. I do want to keep the protocol.
($url) = $url =~ m! (.+?\w) (?: /|\z) !x;