$theTitle=wp_title(" - ", false); if($theTitle != "") { ?>
About Virtualization, VDI, SBC, Application Compatibility and anything else I feel like
Sometimes I want to process a list of “things” easily in PowerShell where the list is not in an external file but in the script itself.
Ideally this list would not be separated by e.g. a comma so it can be easily copy/pasted from external data sources.
Something like this:
1 2 3 4 5 6 | $List = @(" John Doe Jane Doe James Bond And so the list goes on ") |
With a little trickery we can!
1 2 3 4 5 6 7 8 9 10 11 | $List = @(" John Doe Jane Doe James Bond And so the list goes on ") -split "`n" | where {[byte]$_[1] -ne 0x0} foreach ($Entry in $List) { "Performing surgery on $Entry" } |
2 Responses for "Inline arrays in PowerShell"
and people complain about Perl being line noise 😀
my @list = qw(one two three four five six seven) ;
for my $entry ( @list ) {
say “The number is $entry” ;
}
Does it work in perl when you split on several lines?
my @list = qw(
one
two
three
…
Leave a reply