If you have perl 5.10, use the smart-match operator ~~
print "Exist\n" if $var ~~ @array;
It’s almost magic.
More Related Contents:
- Difference of Two Arrays Using Perl
- How do I remove duplicate items from an array in Perl?
- Test if array is inside a list in lisp
- How can I check if a Perl array contains a particular value?
- How can I generate all permutations of an array in Perl?
- In Perl, how can I find the index of a given value in an array?
- How do I print unique elements in Perl array?
- Difference between List and array when initiating [closed]
- Convert Bash script to Perl/VBS/any other windows compatible language [closed]
- Redirecting the perl script
- How can I troubleshoot my Perl CGI script?
- How is Perl’s @INC constructed? (aka What are all the ways of affecting where Perl modules are searched for?)
- How can I install Perl modules without root privileges?
- What is the difference between ‘my’ and ‘our’ in Perl?
- Difference between &function and function() in perl [duplicate]
- How do you round a floating point number in Perl?
- Conversion from List to array T[]
- finding closest value in an array
- Why do I have to specify the -i switch with a backup extension when using ActivePerl?
- How do I declare an array in Python?
- In Perl, is there a built in way to compare two arrays for equality?
- Why is this program valid? I was trying to create a syntax error
- How to sort a list / array of string version number?
- What does the -> arrow do in Perl?
- What’s the differences between system and backticks and pipes in Perl?
- How to ignore ‘Certificate Verify Failed’ error in perl?
- How do I make Perl scripts recognize command-line parameters in the Win32 cmd console?
- In Perl, is it better to use a module than to require a file?
- How do I retrieve the terminal width in Perl?
- Converting an int array to a String array