Skip to content

Instantly share code, notes, and snippets.

View chankeypathak's full-sized avatar
one step closer

Chankey Pathak chankeypathak

one step closer
View GitHub Profile
@chankeypathak
chankeypathak / get_line_number_perl.pl
Last active August 29, 2015 14:03
Get line number of matched pattern in Perl
#!/usr/bin/perl
use strict;
use warnings;
my $data;
{local $/=undef; $data = <DATA>};
if ($data =~ /MATCH_ME/){
print "Found MATCH_ME at Line number: ";
my ($line_num) = (substr $data, 0, $-[0]) =~ s{$/}{}g + 1;
print "$line_num";
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Testing IE Compatibility Mode</title>
<script src="ieUserAgent.js" type="text/javascript"></script>
</head>
<body>
<div id="results">Results:</div>
<script type="text/javascript">
var val = "IE" + ieUserAgent.version;