As one-liner:$file = "test"; (-f $file) ? print("$file is a file") : print("$file is not a file!");
2. Use$ perl -e '$file="test"; (-f $file) ? print("$file is a file") : print("$file is not a file!");';
As one-liner:$file = "test"; (-d $file) ? print("$file is a folder") : print("$file is not a folder!");
3. Use$ perl -e '$file="test"; (-d $file) ? print("$file is a folder") : print("$file is not a folder!");';
As one-liner:$file = "test.txt"; (-e $file) ? print("$file exists!") : print("$file doesn't exist!");
4. Use$ perl -e '$file="test.txt"; (-e $file) ? print("$file exists!") : print("$file doesn't exist!");';
As one-liner:$file = "test.txt"; (-z $file) ? print("$file is empty!") : print("$file isn't empty!");
$ perl -e '$file="test.txt"; (-z $file) ? print("$file is empty!") : print("$file isn't empty!");';