Question about Delete Atom

Dear all,
    By scripting, I can delete atoms which their position of X less than 20, such as below:
foreach my \\\$atom (@{\\\$doc->UnitCell->Atoms}) {

    
    if ((\\\$atom->X<20)) { \\\$atom->Delete;}
   
}

Now I want to delete atoms which their position of X^2+Y^2Best regards,
Yours
CHENG Xu