Hello, I'm new to perl. I searched online,reffered to a couple of links and i have written a perl script to match multiple sting in a file. this is the file :
{ 'testing' => {
link => "http://www.espn.com",,
bandwidth => "100",
r => "2",
}, };10 15 * * * cd /tmp; /path/to/file --timeslot 'name'
Now,I need to write a perl script that matches the string in the file.
find_string { my ($file, $string) = @_; open my $fh, '<', $file; while (<$fh>) { return 1 if /\Q$string/; } die "Unable to find string: $string"; } find_string('filename', "testing");
The above script searches the file for string "testing" in the file and fails if the string is not found. Now I'd like to search multiple strings in that file like bandwidth,rate. I guess i need to use regular expressions.But i'm not sure how to implement it. any suggestions.
In reply to perl regular expressions by iamsachin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |