I came across a code snippet like `$ypmatch $host hosts 2>/dev/null` used in one of the perl files I was browsing. Can anyone let me know the significance of redirecting it to /dev/null.
I will post the same when I find it out.
Wednesday, December 3, 2008
Redirect to /dev/null
Posted by Nexis at 11:32 PM 3 comments
Labels: Queries
Cleaning A Perl File With REGEXP
Following are the regular expressions which can be used to clean your file of unwanted material
1) Replace all the spaces with nothing.
s/\s//g;
2) Skip the lines with comments.next if (m/^\#/);
3) skip blank lines
next if (m/^$/);
4) Replace a line in the file which has commented data on a code line.
s/\#.*$//;
5) Replace a line in the file which has data after semicolon
s/\;.*$//;
Posted by Nexis at 11:12 PM 0 comments
Labels: Perl Regular Expressions
Subscribe to:
Posts (Atom)