473,587 Members | 2,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what does it do undef $/;

56 New Member
Hi,
I am new to Perl and could not understand the below line from an existing Perl Code.

undef $/;

Could anyone please let me know, what does it do? Thanks in advance.

Regards...
Nov 12 '09 #1
2 3469
mohanprasadgutta
33 New Member
Hi,

$/ is the input record seperator.
By default its newline. if you set it to undef no record seperator is matched. usually people used to do

Expand|Select|Wrap|Line Numbers
  1. undef $/;
to read everything to the end of current file.

Below code will read all the sample.txt into a scalar
Expand|Select|Wrap|Line Numbers
  1. open(FILE, "</tmp/sample.txt");
  2. undef $/;
  3. my $content = <FILE>;
  4. close(FILE);
Regards,
Mohan
Nov 12 '09 #2
rasmidas
56 New Member
Thanks. Thanks a lot
Nov 12 '09 #3

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

Similar topics

0
2289
by: DP | last post by:
(2nd post, I think my first may have been to the wrong group - sorry) Hello Perl-ers - I´m hoping I can get some help here, because I'm very lost. Don't know Perl, I'm not a programmer. And this is something that has worked for me earlier, only now it doesn't anymore. --------------------------------- The ¨problem¨ script -
2
4410
by: Sriram | last post by:
Hi, I am having trouble matching a regex that combines a negated character class and an anchor ($). Basically, I want to match all strings that don't end in a digit. So I tried: bash-2.05a@bermuda:15$perl -e 'while (<STDIN>) { if (/$/) { print;}}' skdsklds skdsklds
6
1310
by: Mark Healey | last post by:
I have a program that runs an array through several loops in a single function. For readability I'd like to use descriptive variable names in each loop. I could just declare them at the beginning of the function but it bugs me that I'm using more variables in the function than I need just for readability purposes. Is there something analogous to Linux hard links where I could have a line something like: &var1=&var1;
15
29595
by: informativeguy | last post by:
Hi, I did typedef int Man; After some code I get a necessity to use the same name Man for char. I mean to say,I need to typedef char Man; But how can I do this???
2
1969
by: Old Wolf | last post by:
Is this program alright? #include <stdio.h> #undef EOF int EOF(void) { return 0; } int main(void) { return EOF(); }
3
2373
by: johnperl | last post by:
Hi, I have a question about the perl 'undef' function. I am using it to read all line at once in once string. In the same script i am using sftp to transfer the file created by the script which uses undef. Now undef is not allowing me to pick the file created on local server and transfer it to another local server. Is there any way to close this undef function? I would appreciate help Thank you in advance john
45
9330
by: loudking | last post by:
Hello, all I don't quite understand what does ((time_t)-1) mean when I execute "man 2 time" RETURN VALUE On success, the value of time in seconds since the Epoch is retu rned. On error, ((time_t)-1) is returned, and errno is set
2
1551
by: contactsakthi | last post by:
Hi All, What does the following pre-processor directive do? #define X {{0xff, 0xffff}} Thanks in advance
0
1320
by: myheartinamerica | last post by:
Hello, I was working on a piece of code where a vendor's #define was causing compiler warnings, which led me to try and do the following: #if defined(VAR1) #define VAR1_SAVE VAR1 #undef VAR1 #endif #define VAR1 1
0
7924
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
8349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7978
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5722
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
3845
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...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2364
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
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.