Example: \b is limiting the pattern into the word boundary.
#!/usr/bin/perl -w
print("Please Enter a sentence: \n");
while($_=
{
if(/sky\b/)
{
print("Sky is at the end");
}
if(/\bsky/)
{
print("sky must at the beginning\n");
}
if(/sky\B/)
{
print("sky is not in boundries \n");
}
}
/B can use to find the sentences with that word is not at the end
No comments:
Post a Comment