Okay, I'm still fairly new to PowerShell.
I've written a piece of code that works, but it smells entirely wrong. What is the right way to write this from a PowerShell standpoint?
$filters = @("*a*","*b*")
$data = @("c/a","c/b","c/a/d","e","a","e/f")
$desiredResults = @("e","e/f")
Write-Host "Filters" -ForegroundColor Yellow
$filters
Write-Host "Data" -ForegroundColor Yellow
$data
$results = @()
foreach ($d in $data)
{
[bool] $skip = $false
foreach ($filter in $filters)
{
if ($d -like $filter)
{
$skip = $true
}
}
if ($skip -eq $false)
{
$results += $d
}
}
Write-Host "Desired Results" -ForegroundColor Yellow
$desiredResults
Write-Host "Results" -ForegroundColor Yellow
$results