473,503 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Wot Does this mean?

68 New Member
hey can anyoen tell me wot does this mean

$name =~ s/\n.+//g;
$name =~ s/\s+/_/g;
$name =~ s/^_//;
$name =~ s/_$//;
$name =~ s/[^a-zA-Z0-9_]+//g;
$name =~ s/^[0-9_]+//g;


and this one too..
what will be the value of $item in the following cases:

$item = $item . "" . $_;


$item = $item . "," . $Arguments{"cname"}; [ cname is a textbox ]


Any help is apreciated

Thanks,

Ravi
May 9 '07 #1
4 2172
arne
315 Recognized Expert Contributor
Try http://perldoc.perl.org/. The links on the left (esp. Functions, Operators, Special variables) should explain all you need to understand the code you posted :)
May 9 '07 #2
KevinADC
4,059 Recognized Expert Specialist
well, this stuff:

Expand|Select|Wrap|Line Numbers
  1. $name =~ s/\n.+//g;
  2. $name =~ s/\s+/_/g;
  3. $name =~ s/^_//;
  4. $name =~ s/_$//;
  5. $name =~ s/[^a-zA-Z0-9_]+//g;
  6. $name =~ s/^[0-9_]+//g;
  7.  
means someone doesn't understand how to write regular expressions very well. The other suff is concatenation, or the joining of strings together to make a new string.

Expand|Select|Wrap|Line Numbers
  1. $foo = 'foo';
  2. $bar = 'bar';
  3. $foo = $foo . $bar;
  4. print $foo; [prints "foobar"]
this:

Expand|Select|Wrap|Line Numbers
  1. $foo .= $bar; 
is the same as:

Expand|Select|Wrap|Line Numbers
  1. $foo = $foo . $bar;
this line shows the coder has limited understanding of the "." operator

Expand|Select|Wrap|Line Numbers
  1. $item = $item . "" . $_;
could be written as:

Expand|Select|Wrap|Line Numbers
  1. $item .= $_;
May 9 '07 #3
rock7799
4 New Member
$name =~ s/\n.+//g; this means substitute newline and next all lines with nothing.(g for globaly)

$name =~ s/\s+/_/g; this means substitute mulitple spaces with and underscore.
$name =~ s/^_//; this means substitute word or line starts with(^) underscore to nothing
$name =~ s/_$//; default variable value to nothing
$name =~ s/[^a-zA-Z0-9_]+//g; word with char numbers underscore and following occurance to nothing

$name =~ s/^[0-9_]+//g;
numbers and underscore to nothing

and this one too..
what will be the value of $item in the following cases:

$item = $item . "" . $_; appends default variable to $item


$item = $item . "," . $Arguments{"cname"}; [ cname is a textbox ]

appends comma and a hash value to $item
May 10 '07 #4
KevinADC
4,059 Recognized Expert Specialist
$name =~ s/\n.+//g; this means substitute newline and next all lines with nothing.(g for globaly)

$name =~ s/\s+/_/g; this means substitute mulitple spaces with and underscore.
$name =~ s/^_//; this means substitute word or line starts with(^) underscore to nothing
$name =~ s/_$//; default variable value to nothing
$name =~ s/[^a-zA-Z0-9_]+//g; word with char numbers underscore and following occurance to nothing

$name =~ s/^[0-9_]+//g;
numbers and underscore to nothing

and this one too..
what will be the value of $item in the following cases:

$item = $item . "" . $_; appends default variable to $item


$item = $item . "," . $Arguments{"cname"}; [ cname is a textbox ]

appends comma and a hash value to $item

Some of your explanations are not correct.
May 10 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

70
8807
by: Roy Yao | last post by:
Does it mean "(sizeof(int))* (p)" or "sizeof( (int)(*p) )" ? According to my analysis, operator sizeof, (type) and * have the same precedence, and they combine from right to left. Then this...
3
29660
by: Jukka K. Korpela | last post by:
I have noticed that the meaning of visibility: collapse has been discussed on different forums, but with no consensus on what it really means. Besides, implementations differ. The specification...
2
10196
by: Steve Richter | last post by:
What does the "." mean in the following sql script stmts? use GO if exists (select * from dbo.sysobjects where id = object_id(N'.') and OBJECTPROPERTY(id,N'IsUserTable') = 1) drop table ....
1
8727
by: Frank Rizzo | last post by:
Some of the classes in the framework are marked as thread-safe in the documentation. In particular the docs say the following: "Any public static (*Shared* in Visual Basic) members of this type...
13
4997
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
4
3293
by: Ryan Liu | last post by:
TcpClient has a method called GetworkStream GetStream(); So in other words, there is only one stream associate with it for input and output, right? So while it is receiving, it can not send, and...
89
5947
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be...
13
520
by: Protoman | last post by:
I'm getting an error: 10 C:\Dev-Cpp\Enigma.cpp no match for 'operator<' in 'i < (+cleartext)->std::basic_string<_CharT, _Traits, _Alloc>::end ()' Code: Enigma.hpp...
71
10669
by: active | last post by:
In the main program I check to see if a certain form has been disposed. Does it make sense in that form's FormClosed event to do: Me.Dispose to make sure it is disposed the next time I check. Or...
9
550
by: JoeC | last post by:
m_iWidth = (int)pBitmapInfo->bmiHeader.biWidth; m_iHeight = (int)pBitmapInfo->bmiHeader.biHeight; What does this mean? I have seen v=&var->member.thing; but what does it mean when you...
0
7188
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7063
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7258
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6970
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1489
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.