#!/usr/bin/perl
use strict;
use Data::Dumper;
sub swap{
@_[ 0, 1 ] = @_[ 1, 0 ];
}
sub bsort{
my (@a) = @_;
for my $j (0 .. $#a){
for my $i (0 .. $#a - 1 - $j ){
swap $a[$i], $a[ $i + 1 ] if $a[$i] > $a[ $i + 1 ];
}
}
\@a;
}
#Testing
my $a=1;
my $b=3;
my @c=(3,2,1,4);
print "First:".Dumper(@c);
print "\nLatest:".Dumper(bsort(@c));
Tags: perl
$stopingServices=Get-Service | Where-Object {$_.status -eq "stoping"}
$startingServices=Get-Service | Where-Object {$_.status -eq "starting"}
$runningServices=Get-Service | Where-Object {$_.status -eq "running"}
$stoppedServices=Get-Service | Where-Object {$_.status -eq "stopped"}
if($startingServices){
Write-Host "`nStarting Services: $startingServices"
}
if($stopingServices){
Write-Host "`nStoping Services: $stopingServices"
}
if($runningServices){
Write-Host "`nRunning Services: $runningServices"
}
if($stoppedServices){
Write-Host "`nStopped Services: $stoppedServices"
}
Tags: powershell