In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to use Perl in the Perl operator, I believe most people do not know much about it, so share this article for your reference. I hope you will learn a lot after reading this article. Let's learn about it together.
Perl is not equal to
$/ = "" is not equal to undef$/
We have heard that Perl can simply read a file into a variable, regardless of whether it is binary or not. It seems that you can say $/ = "" more than once.
Always thought so, until encountered a strange phenomenon, the binary file mixed with a 0x0A, such a BUG is very difficult to find, it took a long time to find is to read less content.
Do not understand why Perl is designed like this, bring convenience at the same time you have to know too many details, the rules of the language itself are too complex.
Wouldn't it be more intuitive to equate the effect of Perl not equal to $/ = "" with undef$/;. In view of this, you must be 120000 careful when using Perl. Don't build your program on language features and builtin functions and operators that you don't know very well. What I am going to master is the contents of its regular expressions. Then there is something related to binary operations:
Pack/unpack function.
Substr returns the efficiency of the value as the left value.
Ord,chr.
Rules for int () and integer operations
StringWise bit operation symbol (a total of 4 ~ & | ^)
Problems needing attention in operating binary files with Perl
1. Remember to open a file and use binmode (FILE_HANDLER) .Perl 5.8 open to directly specify how to open it.
This is not necessary under the UNIX system. But it is necessary under windows.
two。 The efficiency and readability of regular expressions should be considered in analyzing a large amount of data.
For readability, complex expressions can be decomposed into subparts, which are compiled with the qr operator.
Another thing is to use the x modifier to separate the parts.
About efficiency, it is necessary to understand some of the internal working mechanisms of regular expressions, such as greed and backtracking and (? >) assertions.
The other is to use the o modifier to make the expression compile only once.
3. Note that all its division operations are floating-point.
Countermeasure: use int () to turn back.
Use useinteger;nointeger. This doesn't know how to use yet.
4. Find out the relationship between the data type of Perl and the machine representation of the data.
Binary data is written in the form of "\ x0\ x1".
The above is all the contents of the article "Perl is not equal to how to use it in the Perl operator". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.