#!/usr/bin/env pwsh
$population = Import-Csv "2024_population.csv"
$total = 0
$population | ForEach-Object {
    $total += [long]($_.'2024_last_updated'.Replace(',', ''))
}
Write-Output "World population: $total"


# variant using Measure-Object
$total = $population | ForEach-Object {
     [long]($_.'2024_last_updated'.Replace(',', ''))
} | Measure-Object -Sum 
Write-Output "World population: $($total.Sum)"
