$dbh->SELECT(':$name, :$email, :$duration(from - to) FROM table WHERE duration > $min_duration' { say "$name <$email> has spent $duration days here"; } #### $dbh->prepare('SELECT name, email, from - to AS duration FROM table WHERE duration > ?'); $dbh->bind_columns(\my ($name, $email, $duration); $dbh->execute($min_duration); while ($sth->fetch) { say "$name <$email> has spent $duration days here"; }