Perl: how check if variable is empty

Need a Perl equivilant of PHPs empty() ?

Purpose: Check is $value is empty

if( $value =~ /^\s*$/)
{
  #...
}

Purpose: Check is $value is not empty

if( $value !~ /^\s*$/ )
{
  #...
}

Justin Kelly

Justin Kelly

Web Developer, Business Analytics, Data Engineer specialising in PHP, ReactJS, Tableau, AWS RedShift and Matillion ETL

Based in Melbourne, Australia

Feel free to contact me justin@kelly.org.au or _justin_kelly

Leave a comment

Name Notify me of replies by email.