[This](https://stackoverflow.com/questions/20224822/how-to-check-if-a-file-contains-only-zeros-in-a-linux-shell/20225286#20225286) was the original question. 

Using perl, how can I detect from the command line if a specified file contains only a specified character(s), like '0' for example? 

I tried

```
perl -ne 'print if s/(^0*$)/yes/' filename

```

But it cannot detect all conditions, for example multiple lines, non-zero lines. 

Sample input - 

A file containing only zeros - 

```
0000000000000000000000000000000000000000000000000000000000000

```

output - `"yes"`

```
Empty file

```

output - `"no"`

File containing zeros but has newline 

```
000000000000000000
000000000000

```

output - `"no"` 

File containing mixture 

```
0324234-234-324000324200000

```

output - `"no"`