perl newbie


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting perl newbie
# 1  
Old 01-01-2009
perl newbie

what is the difference in regexes using symbols like

^NAME$|^SELF$

and

\bNAME\b
\bSELF\b
# 2  
Old 01-01-2009
^ = beginning of string anchor
$ = end of string anchor
\b = word boundary anchor

if NAME or SELF is the only thing in the string being searched they will all work the same. But if there is more text/patterns to search for they will not as ^NAME$ and ^SELF$ mean to find that word and only that word but \bNAME\b could be part of a larger string.

perlretut - perldoc.perl.org
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Hidden Characters in Regular Expression Matching Perl - Perl Newbie

I am completely new to perl programming. My father is helping me learn said programming language. However, I am stuck on one of the assignments he has given me, and I can't find very much help with it via google, either because I have a tiny attention span, or because I can be very very dense. ... (4 Replies)
Discussion started by: kittyluva2
4 Replies

2. Shell Programming and Scripting

Perl newbie question re: variables

Hi there apologies for the really basic question but if i have a variable called $string that I want to run a regex against and output to another variable ...how do i do it, I know that if i wanted to alter the current $string variable i would do $string=~ s/old/new/g; but i kind of want... (2 Replies)
Discussion started by: rethink
2 Replies

3. UNIX for Dummies Questions & Answers

perl newbie question

I have the following question in perl, I have come up with couple of solutions,Perl gurus please help me find the best answer to my question? You have a PERL database named DataEntryData, and you need to separate out the various values from the DB entry $item, delimited by the ^ sumbol. There... (2 Replies)
Discussion started by: ramky79
2 Replies

4. Shell Programming and Scripting

Perl newbie questions!

Hi, So I started to learn perl a few days ago, and I have some problems... One of my problems... #!C:\Perl64\bin\perl.exe -w use LWP::Simple; print "Content-Type: Text/Plain\n\n"; sub pagelinks { return @all = get($_) =~ /href\s*=\s*"?(+)/gis; } @a =... (5 Replies)
Discussion started by: byte1918
5 Replies

5. Shell Programming and Scripting

perl newbie . &&..programming newbie

Hi, I am new to programming and also to perl..But i know 'perl' can come to my rescue, But I am stuck at many places and need help..any small help is much appreciated... below is the description of what i intend to acheive with my script. I have a files named in this format... (13 Replies)
Discussion started by: xytiz
13 Replies

6. Shell Programming and Scripting

perl newbie . &&..programming newbie (question 2)

Hello everyone, I am having to do a lot of perl scripting these days and I am learning a lot. I have this problem I want to move files from a folder and all its sub folders to one parent folder, they are all .gz files.. there is folder1\folder2\*.gz and there are about 50 folders... (1 Reply)
Discussion started by: xytiz
1 Replies

7. Shell Programming and Scripting

Newbie to perl - Help with stats script

Hi, this is my first post so here goes..... I need help... I am trying to write a script to produce some stats based on a number of searches in a log file. Now i know how to do this using multiple variables which are really just greps, but I want a more efficent way of doing this as my poor... (1 Reply)
Discussion started by: ARwebble
1 Replies

8. Shell Programming and Scripting

Perl Newbie - help!

Hi All, newbie-ish question here. I have this script: foreach $test (@num) { foreach $record (@neet) { if ($record =~ /$test/){ print "$record \n"; print $test; } } } For some reason, the $test variable doesn't seem to be carrying into the second "foreach" loop. Does anyone know why... (1 Reply)
Discussion started by: Khoomfire
1 Replies

9. Shell Programming and Scripting

perl newbie: how to extract an unknown word from a string

hi, im quite new to perl regexp. i have a problem where i want to extract a word from a given string. but the word is unknown, only fact is that it appears as the second word in the string. Eg. input string(s) : char var1 = 'A'; int var2 = 10; char *ptr; and what i want to do is... (3 Replies)
Discussion started by: wolwy_pete
3 Replies

10. Shell Programming and Scripting

Perl newbie question

Can someone tell me what this is doing? I know it is reading records from a table and puts them in a hash. How do I print out, let's say, the first 5 columns of data (assuming columns are named col1, col2, ...)? $sth = $dbh->prepare("select * from stsc.loc ... (2 Replies)
Discussion started by: ssmiths001
2 Replies
Login or Register to Ask a Question