473,656 Members | 2,983 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{"cna me"}; [ cname is a textbox ]


Any help is apreciated

Thanks,

Ravi
May 9 '07 #1
4 2176
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{"cna me"}; [ 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{"cna me"}; [ 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
8858
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 expression should equal to "sizeof( (int)(*p) )", but the compiler does NOT think so. Why? Can anyone help me? Thanks. Best regards. Roy
3
29675
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 says: "The 'visibility' property takes the value 'collapse' for row, row group, column, and column group elements. This value causes the entire row or column to be removed from the display, and the space normally taken up by the row or column to...
2
10209
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 . GO
1
8735
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 are thread safe. Any instance members are not guaranteed to be thread safe." What exactly does this mean? Does this mean that if I call a shared method from 2 different threads, nothing whacky will happen? Also when it says that instance members...
13
5035
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
3300
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 vise visa, right? So will it be a problem both server and client can initiative a sending action? TcpClient only supports synchronous operation. What does "Synchronous" mean? Means while it is reading or waiting for data to arrive from the...
89
6034
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 used." Could anybody tell me why gets() function is dangerous?? Thank you very much. Cuthbert
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 -------------------------- #pragma once
71
10722
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 is that automatic? Thanks
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 change the & for int?
0
8380
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8296
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7310
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2721
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 we have to send another system
2
1928
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.